| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | //-------------------------------------------------------- | ||
| 2 | // Zelda Classic | ||
| 3 | // by Jeremy Craner, 1999-2000 | ||
| 4 | // | ||
| 5 | // guys.cc | ||
| 6 | // | ||
| 7 | // "Guys" code (and other related stuff) for zelda.cc | ||
| 8 | // | ||
| 9 | //-------------------------------------------------------- | ||
| 10 | |||
| 11 | #include "precompiled.h" //always first | ||
| 12 | |||
| 13 | #include <string.h> | ||
| 14 | #include <stdio.h> | ||
| 15 | #include "base/zc_alleg.h" | ||
| 16 | #include "guys.h" | ||
| 17 |
1/2✓ Branch 0 taken 33 times.
✗ Branch 1 not taken.
|
33 | #include "zelda.h" |
| 18 | #include "base/zsys.h" | ||
| 19 | #include "maps.h" | ||
| 20 | #include "hero.h" | ||
| 21 | #include "subscr.h" | ||
| 22 | #include "ffscript.h" | ||
| 23 | #include "gamedata.h" | ||
| 24 | #include "defdata.h" | ||
| 25 | #include "zscriptversion.h" | ||
| 26 | #include "particles.h" | ||
| 27 | #include "base/zc_math.h" | ||
| 28 | #include "slopes.h" | ||
| 29 | extern particle_list particles; | ||
| 30 | |||
| 31 | extern FFScript FFCore; | ||
| 32 | extern word item_doscript[256]; | ||
| 33 | extern refInfo itemScriptData[256]; | ||
| 34 | extern int32_t item_stack[256][MAX_SCRIPT_REGISTERS]; | ||
| 35 | extern ZModule zcm; | ||
| 36 | extern HeroClass Hero; | ||
| 37 | extern sprite_list guys, items, Ewpns, Lwpns, Sitems, chainlinks, decorations; | ||
| 38 | extern zinitdata zinit; | ||
| 39 | |||
| 40 | int32_t repaircharge=0; | ||
| 41 | bool adjustmagic=false; | ||
| 42 | bool learnslash=false; | ||
| 43 | int32_t wallm_load_clk=0; | ||
| 44 | int32_t sle_x,sle_y,sle_cnt,sle_clk=0; | ||
| 45 | int32_t vhead=0; | ||
| 46 | int32_t guycarryingitem=0; | ||
| 47 | |||
| 48 | char *guy_string[eMAXGUYS]; | ||
| 49 | |||
| 50 | void never_return(int32_t index); | ||
| 51 | void playLevelMusic(); | ||
| 52 | |||
| 53 | // If an enemy is this far out of the playing field, just remove it. | ||
| 54 | #define OUTOFBOUNDS ((int32_t)y>((isSideViewGravity() && canfall(id))?192:352) || y<-176 || x<-256 || x > 512) | ||
| 55 | //#define NEWOUTOFBOUNDS ((int32_t)y>32767 || y<-32767 || x<-32767 || x > 32767) | ||
| 56 | #define IGNORE_SIDEVIEW_PLATFORMS (editorflags & ENEMY_FLAG14) | ||
| 57 | #define OFFGRID_ENEMY (editorflags & ENEMY_FLAG15) | ||
| 58 | |||
| 59 | 608339 | void do_fix(zfix& coord, int32_t val, bool nearest_half = false) | |
| 60 | { | ||
| 61 | 608339 | int32_t c = coord.getInt(); | |
| 62 |
2/2✓ Branch 0 taken 267 times.
✓ Branch 1 taken 608072 times.
|
608339 | if(nearest_half) |
| 63 | { | ||
| 64 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 608072 times.
|
608072 | if (c < 0) |
| 65 | ✗ | c -= val / 2; | |
| 66 | 608072 | else c += (val/2); | |
| 67 | 608072 | } | |
| 68 | 608339 | c -= c % val; | |
| 69 | 608339 | coord = c; | |
| 70 | 608339 | } | |
| 71 | |||
| 72 | ✗ | bool NEWOUTOFBOUNDS(zfix x, zfix y, zfix z) | |
| 73 | { | ||
| 74 | ✗ | return | |
| 75 | ( | ||
| 76 | ✗ | (((int32_t)y) > FFCore.enemy_removal_point[spriteremovalY2]) | |
| 77 | ✗ | || (((int32_t)y) < FFCore.enemy_removal_point[spriteremovalY1]) | |
| 78 | ✗ | || (((int32_t)x) < FFCore.enemy_removal_point[spriteremovalX1]) | |
| 79 | ✗ | || (((int32_t)x) > FFCore.enemy_removal_point[spriteremovalX2]) | |
| 80 | ✗ | || (((int32_t)z) < FFCore.enemy_removal_point[spriteremovalZ1]) | |
| 81 | ✗ | || (((int32_t)z) > FFCore.enemy_removal_point[spriteremovalZ2]) | |
| 82 | ); | ||
| 83 | } | ||
| 84 | |||
| 85 | namespace | ||
| 86 | { | ||
| 87 | int32_t trapConstantHorizontalID; | ||
| 88 | int32_t trapConstantVerticalID; | ||
| 89 | int32_t trapLOSHorizontalID; | ||
| 90 | int32_t trapLOSVerticalID; | ||
| 91 | int32_t trapLOS4WayID; | ||
| 92 | |||
| 93 | int32_t cornerTrapID; | ||
| 94 | int32_t centerTrapID; | ||
| 95 | |||
| 96 | int32_t rockID; | ||
| 97 | int32_t zoraID; | ||
| 98 | int32_t statueID; | ||
| 99 | } | ||
| 100 | |||
| 101 | 101 | void identifyCFEnemies() | |
| 102 | { | ||
| 103 | 101 | trapConstantHorizontalID=-1; | |
| 104 | 101 | trapConstantVerticalID=-1; | |
| 105 | 101 | trapLOSHorizontalID=-1; | |
| 106 | 101 | trapLOSVerticalID=-1; | |
| 107 | 101 | trapLOS4WayID=-1; | |
| 108 | 101 | cornerTrapID=-1; | |
| 109 | 101 | centerTrapID=-1; | |
| 110 | 101 | rockID=-1; | |
| 111 | 101 | zoraID=-1; | |
| 112 | 101 | statueID=-1; | |
| 113 | |||
| 114 |
2/2✓ Branch 0 taken 51712 times.
✓ Branch 1 taken 101 times.
|
51813 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 115 | { | ||
| 116 |
3/4✓ Branch 0 taken 100 times.
✓ Branch 1 taken 51612 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 100 times.
|
51712 | if((guysbuf[i].flags2&cmbflag_trph) && trapLOSHorizontalID==-1) |
| 117 | 100 | trapLOSHorizontalID=i; | |
| 118 |
4/4✓ Branch 0 taken 104 times.
✓ Branch 1 taken 51608 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&cmbflag_trpv) && trapLOSVerticalID==-1) |
| 119 | 101 | trapLOSVerticalID=i; | |
| 120 |
3/4✓ Branch 0 taken 101 times.
✓ Branch 1 taken 51611 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&cmbflag_trp4) && trapLOS4WayID==-1) |
| 121 | 101 | trapLOS4WayID=i; | |
| 122 |
3/4✓ Branch 0 taken 101 times.
✓ Branch 1 taken 51611 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&cmbflag_trplr) && trapConstantHorizontalID==-1) |
| 123 | 101 | trapConstantHorizontalID=i; | |
| 124 |
3/4✓ Branch 0 taken 101 times.
✓ Branch 1 taken 51611 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&cmbflag_trpud) && trapConstantVerticalID==-1) |
| 125 | 101 | trapConstantVerticalID=i; | |
| 126 | |||
| 127 |
3/4✓ Branch 0 taken 101 times.
✓ Branch 1 taken 51611 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&eneflag_trap) && cornerTrapID==-1) |
| 128 | 101 | cornerTrapID=i; | |
| 129 |
3/4✓ Branch 0 taken 101 times.
✓ Branch 1 taken 51611 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&eneflag_trp2) && centerTrapID==-1) |
| 130 | 101 | centerTrapID=i; | |
| 131 | |||
| 132 |
3/4✓ Branch 0 taken 101 times.
✓ Branch 1 taken 51611 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&eneflag_rock) && rockID==-1) |
| 133 | 101 | rockID=i; | |
| 134 |
4/4✓ Branch 0 taken 106 times.
✓ Branch 1 taken 51606 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2&eneflag_zora) && zoraID==-1) |
| 135 | 101 | zoraID=i; | |
| 136 | |||
| 137 |
4/4✓ Branch 0 taken 107 times.
✓ Branch 1 taken 51605 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 101 times.
|
51712 | if((guysbuf[i].flags2 & eneflag_fire) && statueID==-1) |
| 138 | 101 | statueID=i; | |
| 139 | 51712 | } | |
| 140 | 101 | } | |
| 141 | |||
| 142 | 25 | int32_t random_layer_enemy() | |
| 143 | { | ||
| 144 | 25 | int32_t cnt=count_layer_enemies(); | |
| 145 | |||
| 146 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if(cnt==0) |
| 147 | { | ||
| 148 | ✗ | return eNONE; | |
| 149 | } | ||
| 150 | |||
| 151 | 25 | int32_t ret=zc_oldrand()%cnt; | |
| 152 | 25 | cnt=0; | |
| 153 | |||
| 154 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | for(int32_t i=0; i<6; ++i) |
| 155 | { | ||
| 156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | if(tmpscr->layermap[i]!=0) |
| 157 | { | ||
| 158 | 25 | mapscr *layerscreen=&TheMaps[(tmpscr->layermap[i]-1)*MAPSCRS]+tmpscr->layerscreen[i]; | |
| 159 | |||
| 160 |
1/2✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
|
127 | for(int32_t j=0; j<10; ++j) |
| 161 | { | ||
| 162 |
2/4✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 127 times.
|
127 | if(layerscreen->enemy[j]>0&&layerscreen->enemy[j]<MAXGUYS) |
| 163 | { | ||
| 164 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 102 times.
|
127 | if(cnt==ret) |
| 165 | { | ||
| 166 | 25 | return layerscreen->enemy[j]; | |
| 167 | } | ||
| 168 | |||
| 169 | 102 | ++cnt; | |
| 170 | 102 | } | |
| 171 | 102 | } | |
| 172 | ✗ | } | |
| 173 | ✗ | } | |
| 174 | |||
| 175 | ✗ | return eNONE; | |
| 176 | 25 | } | |
| 177 | |||
| 178 | 39 | int32_t count_layer_enemies() | |
| 179 | { | ||
| 180 | 39 | int32_t cnt=0; | |
| 181 | |||
| 182 |
2/2✓ Branch 0 taken 234 times.
✓ Branch 1 taken 39 times.
|
273 | for(int32_t i=0; i<6; ++i) |
| 183 | { | ||
| 184 |
2/2✓ Branch 0 taken 195 times.
✓ Branch 1 taken 39 times.
|
234 | if(tmpscr->layermap[i]!=0) |
| 185 | { | ||
| 186 | 39 | mapscr *layerscreen=&TheMaps[(tmpscr->layermap[i]-1)*MAPSCRS]+tmpscr->layerscreen[i]; | |
| 187 | |||
| 188 |
2/2✓ Branch 0 taken 390 times.
✓ Branch 1 taken 39 times.
|
429 | for(int32_t j=0; j<10; ++j) |
| 189 | { | ||
| 190 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 390 times.
|
390 | if(layerscreen->enemy[j]!=0) |
| 191 | { | ||
| 192 | 390 | ++cnt; | |
| 193 | 390 | } | |
| 194 | 390 | } | |
| 195 | 39 | } | |
| 196 | 234 | } | |
| 197 | |||
| 198 | 39 | return cnt; | |
| 199 | } | ||
| 200 | |||
| 201 | 134837 | int32_t hero_on_wall() | |
| 202 | { | ||
| 203 | 134837 | zfix lx = Hero.getX(); | |
| 204 | 134837 | zfix ly = Hero.getY(); | |
| 205 | |||
| 206 | |||
| 207 | //zprint2("hero_on_wall x is: %d\n", lx); | ||
| 208 | //zprint2("hero_on_wall y is: %d\n", ly); | ||
| 209 | |||
| 210 |
4/4✓ Branch 0 taken 125829 times.
✓ Branch 1 taken 9008 times.
✓ Branch 2 taken 4059 times.
✓ Branch 3 taken 121770 times.
|
134837 | if(lx>=48 && lx<=192) |
| 211 | { | ||
| 212 |
2/2✓ Branch 0 taken 146 times.
✓ Branch 1 taken 121624 times.
|
121770 | if(ly==32) return up+1; |
| 213 | |||
| 214 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 121494 times.
|
121624 | if(ly==128) return down+1; |
| 215 | 121494 | } | |
| 216 | |||
| 217 |
4/4✓ Branch 0 taken 125366 times.
✓ Branch 1 taken 9195 times.
✓ Branch 2 taken 10454 times.
✓ Branch 3 taken 114912 times.
|
134561 | if(ly>=48 && ly<=112) |
| 218 | { | ||
| 219 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 114784 times.
|
114912 | if(lx==32) return left+1; |
| 220 | |||
| 221 |
2/2✓ Branch 0 taken 114724 times.
✓ Branch 1 taken 60 times.
|
114784 | if(lx==208) return right+1; |
| 222 | 114724 | } | |
| 223 | |||
| 224 | 134373 | return 0; | |
| 225 | 134837 | } | |
| 226 | |||
| 227 | 681853 | bool tooclose(int32_t x,int32_t y,int32_t d) | |
| 228 | { | ||
| 229 |
2/2✓ Branch 0 taken 504986 times.
✓ Branch 1 taken 176867 times.
|
681853 | return (abs(int32_t(HeroX())-x)<d && abs(int32_t(HeroY())-y)<d); |
| 230 | } | ||
| 231 | |||
| 232 | 1894781 | bool enemy::overpit(enemy *e) | |
| 233 | { | ||
| 234 |
2/2✓ Branch 0 taken 1891613 times.
✓ Branch 1 taken 23978548 times.
|
25870161 | for ( int32_t q = 0; q < hxsz; ++q ) |
| 235 | { | ||
| 236 |
2/2✓ Branch 0 taken 231621836 times.
✓ Branch 1 taken 23975380 times.
|
255597216 | for ( int32_t q = 0; q < hysz; ++q ) |
| 237 | { | ||
| 238 | //check every pixel of the hitbox | ||
| 239 |
2/2✓ Branch 0 taken 3168 times.
✓ Branch 1 taken 231618668 times.
|
231621836 | if ( ispitfall(x+q+hxofs, y+q+hyofs) ) |
| 240 | { | ||
| 241 | //if the hitbox is over a pit, we can't land | ||
| 242 | 3168 | return true; | |
| 243 | } | ||
| 244 | 231618668 | } | |
| 245 | 23975380 | } | |
| 246 | 1891613 | return false; | |
| 247 | 1894781 | } | |
| 248 | |||
| 249 | 3423082 | bool enemy::shadow_overpit(enemy *e) | |
| 250 | { | ||
| 251 |
2/2✓ Branch 0 taken 3419230 times.
✓ Branch 1 taken 52262892 times.
|
55682122 | for ( int32_t q = 0; q < hxsz; ++q ) |
| 252 | { | ||
| 253 |
2/2✓ Branch 0 taken 787255747 times.
✓ Branch 1 taken 52259040 times.
|
839514787 | for ( int32_t q = 0; q < hysz; ++q ) |
| 254 | { | ||
| 255 | //check every pixel of the hitbox | ||
| 256 |
2/2✓ Branch 0 taken 3852 times.
✓ Branch 1 taken 787251895 times.
|
787255747 | if ( ispitfall(x+q+hxofs, y+q+hyofs+hysz-2) ) |
| 257 | { | ||
| 258 | //if the hitbox is over a pit, we can't land | ||
| 259 | 3852 | return true; | |
| 260 | } | ||
| 261 | 787251895 | } | |
| 262 | 52259040 | } | |
| 263 | 3419230 | return false; | |
| 264 | 3423082 | } | |
| 265 | |||
| 266 | // Returns true iff a combo type or flag precludes enemy movement. | ||
| 267 | 3655860 | bool enemy::groundblocked(int32_t dx, int32_t dy, bool isKB) | |
| 268 | { | ||
| 269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3655860 times.
|
3655860 | if(moveflags & FLAG_IGNORE_BLOCKFLAGS) return false; |
| 270 | 3655860 | int32_t c = COMBOTYPE(dx,dy); | |
| 271 |
4/4✓ Branch 0 taken 2393092 times.
✓ Branch 1 taken 1262768 times.
✓ Branch 2 taken 603955 times.
✓ Branch 3 taken 658813 times.
|
4918628 | bool pit_blocks = (!(moveflags & (FLAG_CAN_PITWALK|FLAG_ONLY_PITWALK)) && (!(moveflags & FLAG_CAN_PITFALL) || !isKB)); |
| 272 |
3/6✓ Branch 0 taken 1248968 times.
✓ Branch 1 taken 2406892 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1248968 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3655860 | bool water_blocks = (!(moveflags & (FLAG_CAN_WATERWALK|FLAG_ONLY_WATERWALK|FLAG_ONLY_SHALLOW_WATERWALK)) && (!(moveflags & FLAG_CAN_WATERDROWN) || !isKB) && get_bit(quest_rules,qr_DROWN)); |
| 273 |
4/6✓ Branch 0 taken 1284387 times.
✓ Branch 1 taken 2371473 times.
✓ Branch 2 taken 1284387 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1284387 times.
✗ Branch 5 not taken.
|
7312235 | return c==cPIT || c==cPITB || c==cPITC || |
| 274 |
4/6✓ Branch 0 taken 1284387 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1284387 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1187342 times.
✓ Branch 5 taken 97045 times.
|
1284387 | c==cPITD || c==cPITR || (pit_blocks && ispitfall(dx,dy)) || |
| 275 | // Block enemies type and block enemies flags | ||
| 276 |
2/2✓ Branch 0 taken 1283039 times.
✓ Branch 1 taken 1185994 times.
|
97045 | combo_class_buf[c].block_enemies&1 || |
| 277 |
3/4✓ Branch 0 taken 1283037 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1283037 times.
✗ Branch 3 not taken.
|
1283039 | MAPFLAG(dx,dy)==mfNOENEMY || MAPCOMBOFLAG(dx,dy)==mfNOENEMY || |
| 278 |
4/4✓ Branch 0 taken 1282818 times.
✓ Branch 1 taken 219 times.
✓ Branch 2 taken 1282808 times.
✓ Branch 3 taken 10 times.
|
1283037 | MAPFLAG(dx,dy)==mfNOGROUNDENEMY || MAPCOMBOFLAG(dx,dy)==mfNOGROUNDENEMY || |
| 279 | // Check for ladder-only combos which aren't dried water | ||
| 280 |
4/4✓ Branch 0 taken 641 times.
✓ Branch 1 taken 1282167 times.
✓ Branch 2 taken 636 times.
✓ Branch 3 taken 5 times.
|
2565611 | (combo_class_buf[c].ladder_pass&1 && !iswater_type(c)) || |
| 281 | // Check for drownable water | ||
| 282 |
4/4✓ Branch 0 taken 116125 times.
✓ Branch 1 taken 1166678 times.
✓ Branch 2 taken 10688 times.
✓ Branch 3 taken 105437 times.
|
1282803 | (water_blocks && !(isSideViewGravity()) && (iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx, dy, false, false, true, false, false))); |
| 283 | 1284902 | } | |
| 284 | |||
| 285 | // Returns true iff enemy is floating and blocked by a combo type or flag. | ||
| 286 | 4239589 | bool enemy::flyerblocked(int32_t dx, int32_t dy, int32_t special, bool isKB) | |
| 287 | { | ||
| 288 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4239589 times.
|
4239589 | if(moveflags & FLAG_IGNORE_BLOCKFLAGS) return false; |
| 289 |
4/4✓ Branch 0 taken 2791752 times.
✓ Branch 1 taken 1447837 times.
✓ Branch 2 taken 1220488 times.
✓ Branch 3 taken 227349 times.
|
5687426 | bool pit_blocks = (!(moveflags & FLAG_CAN_PITWALK) && (!(moveflags & FLAG_CAN_PITFALL) || !isKB)); |
| 290 |
3/4✓ Branch 0 taken 2801756 times.
✓ Branch 1 taken 1437833 times.
✓ Branch 2 taken 1437833 times.
✗ Branch 3 not taken.
|
5677422 | bool water_blocks = (!(moveflags & FLAG_CAN_WATERWALK) && (!(moveflags & FLAG_CAN_WATERDROWN) || !isKB)); |
| 291 |
2/2✓ Branch 0 taken 525666 times.
✓ Branch 1 taken 3713923 times.
|
7953512 | return ((special==spw_floater)&& |
| 292 |
2/2✓ Branch 0 taken 3707812 times.
✓ Branch 1 taken 6111 times.
|
3713923 | ((COMBOTYPE(dx,dy)==cNOFLYZONE)|| |
| 293 |
1/2✓ Branch 0 taken 3707812 times.
✗ Branch 1 not taken.
|
3707812 | (combo_class_buf[COMBOTYPE(dx,dy)].block_enemies&4)|| |
| 294 |
2/2✓ Branch 0 taken 3707801 times.
✓ Branch 1 taken 11 times.
|
3707812 | (MAPFLAG(dx,dy)==mfNOENEMY)|| |
| 295 |
1/2✓ Branch 0 taken 3707801 times.
✗ Branch 1 not taken.
|
3707801 | (MAPCOMBOFLAG(dx,dy)==mfNOENEMY)|| |
| 296 |
4/4✓ Branch 0 taken 971536 times.
✓ Branch 1 taken 2736265 times.
✓ Branch 2 taken 1984 times.
✓ Branch 3 taken 969552 times.
|
7413618 | (water_blocks && iswaterex(MAPCOMBO(dx, dy), currmap, currscr, -1, dx,dy, false, false, true)) || |
| 297 |
2/2✓ Branch 0 taken 2729802 times.
✓ Branch 1 taken 976015 times.
|
3705817 | (pit_blocks && ispitfall(dx,dy)))); |
| 298 | 4239589 | } | |
| 299 | // Returns true iff a combo type or flag precludes enemy movement. | ||
| 300 | 241498 | bool groundblocked(int32_t dx, int32_t dy, guydata const& gd) | |
| 301 | { | ||
| 302 | 241498 | int32_t c = COMBOTYPE(dx,dy); | |
| 303 | 241498 | bool pit_blocks = !(gd.moveflags & FLAG_CAN_PITWALK); | |
| 304 |
2/2✓ Branch 0 taken 27325 times.
✓ Branch 1 taken 214173 times.
|
241498 | bool water_blocks = !(gd.moveflags & FLAG_CAN_WATERWALK) && get_bit(quest_rules,qr_DROWN); |
| 305 |
3/6✓ Branch 0 taken 241498 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 241498 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 241498 times.
✗ Branch 5 not taken.
|
917746 | return c==cPIT || c==cPITB || c==cPITC || |
| 306 |
4/6✓ Branch 0 taken 241498 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 241498 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 217463 times.
✓ Branch 5 taken 24035 times.
|
241498 | c==cPITD || c==cPITR || (pit_blocks && ispitfall(dx,dy)) || |
| 307 | // Block enemies type and block enemies flags | ||
| 308 |
2/2✓ Branch 0 taken 241410 times.
✓ Branch 1 taken 217375 times.
|
24035 | combo_class_buf[c].block_enemies&1 || |
| 309 |
3/4✓ Branch 0 taken 241274 times.
✓ Branch 1 taken 136 times.
✓ Branch 2 taken 241274 times.
✗ Branch 3 not taken.
|
241410 | MAPFLAG(dx,dy)==mfNOENEMY || MAPCOMBOFLAG(dx,dy)==mfNOENEMY || |
| 310 |
4/4✓ Branch 0 taken 237801 times.
✓ Branch 1 taken 3473 times.
✓ Branch 2 taken 237545 times.
✓ Branch 3 taken 256 times.
|
241274 | MAPFLAG(dx,dy)==mfNOGROUNDENEMY || MAPCOMBOFLAG(dx,dy)==mfNOGROUNDENEMY || |
| 311 | // Check for ladder-only combos which aren't dried water | ||
| 312 |
3/4✓ Branch 0 taken 34 times.
✓ Branch 1 taken 237511 times.
✓ Branch 2 taken 34 times.
✗ Branch 3 not taken.
|
475090 | (combo_class_buf[c].ladder_pass&1 && !iswater_type(c)) || |
| 313 | // Check for drownable water | ||
| 314 |
4/4✓ Branch 0 taken 35833 times.
✓ Branch 1 taken 201712 times.
✓ Branch 2 taken 27451 times.
✓ Branch 3 taken 8382 times.
|
237545 | (water_blocks && !(isSideViewGravity()) && (iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx, dy, false, false, true))); |
| 315 | } | ||
| 316 | |||
| 317 | // Returns true iff enemy is floating and blocked by a combo type or flag. | ||
| 318 | 114598 | bool flyerblocked(int32_t dx, int32_t dy, int32_t special, guydata const& gd) | |
| 319 | { | ||
| 320 |
2/2✓ Branch 0 taken 112991 times.
✓ Branch 1 taken 1607 times.
|
114598 | bool pit_blocks = (!(gd.moveflags & FLAG_CAN_PITWALK) && !(gd.moveflags & FLAG_CAN_PITFALL)); |
| 321 | 114598 | bool water_blocks = !(gd.moveflags & FLAG_CAN_WATERWALK); | |
| 322 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 114598 times.
|
229196 | return ((special==spw_floater)&& |
| 323 |
1/2✓ Branch 0 taken 114598 times.
✗ Branch 1 not taken.
|
114598 | ((COMBOTYPE(dx,dy)==cNOFLYZONE)|| |
| 324 |
1/2✓ Branch 0 taken 114598 times.
✗ Branch 1 not taken.
|
114598 | (combo_class_buf[COMBOTYPE(dx,dy)].block_enemies&4)|| |
| 325 |
1/2✓ Branch 0 taken 114598 times.
✗ Branch 1 not taken.
|
114598 | (MAPFLAG(dx,dy)==mfNOENEMY)|| |
| 326 |
1/2✓ Branch 0 taken 114598 times.
✗ Branch 1 not taken.
|
114598 | (MAPCOMBOFLAG(dx,dy)==mfNOENEMY)|| |
| 327 |
4/4✓ Branch 0 taken 1607 times.
✓ Branch 1 taken 112991 times.
✓ Branch 2 taken 218 times.
✓ Branch 3 taken 1389 times.
|
228978 | (water_blocks && iswaterex(MAPCOMBO(dx,dy), currmap, currscr, -1, dx, dy, false, false, true)) || |
| 328 |
2/2✓ Branch 0 taken 112991 times.
✓ Branch 1 taken 1389 times.
|
114380 | (pit_blocks && ispitfall(dx,dy)))); |
| 329 | } | ||
| 330 | |||
| 331 | /**********************************/ | ||
| 332 | /******* Enemy Base Class *******/ | ||
| 333 | /**********************************/ | ||
| 334 | |||
| 335 | /* ROM data flags | ||
| 336 | |||
| 337 | */ | ||
| 338 | |||
| 339 | ✗ | eFire::eFire(eFire const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 340 | //Struct Element Type Purpose | ||
| 341 | //sprite(other), | ||
| 342 | ✗ | enemy(other), | |
| 343 | ✗ | clk4(other.clk4), | |
| 344 | ✗ | shield(other.shield) | |
| 345 | |||
| 346 | ✗ | { | |
| 347 | |||
| 348 | //arrays | ||
| 349 | |||
| 350 | ✗ | if(other.scrmem) | |
| 351 | { | ||
| 352 | ✗ | alloc_scriptmem(); | |
| 353 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 354 | |||
| 355 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 356 | ✗ | } | |
| 357 | ✗ | else scrmem = NULL; | |
| 358 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 359 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 360 | |||
| 361 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 362 | ✗ | defense[i]=other.defense[i]; | |
| 363 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 364 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 365 | |||
| 366 | ✗ | if(new_script_uid) | |
| 367 | { | ||
| 368 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 369 | ✗ | } | |
| 370 | ✗ | if(clear_parent_script_UID) | |
| 371 | { | ||
| 372 | ✗ | parent_script_UID = 0; | |
| 373 | ✗ | } | |
| 374 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 375 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 376 | |||
| 377 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 378 | { | ||
| 379 | ✗ | initD[q] = other.initD[q]; | |
| 380 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 381 | ✗ | } | |
| 382 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 383 | { | ||
| 384 | ✗ | initA[q] = other.initA[q]; | |
| 385 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 386 | ✗ | } | |
| 387 | ✗ | } | |
| 388 | |||
| 389 | ✗ | eOther::eOther(eOther const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 390 | //Struct Element Type Purpose | ||
| 391 | //sprite(other), | ||
| 392 | ✗ | enemy(other), | |
| 393 | ✗ | clk4(other.clk4), | |
| 394 | ✗ | shield(other.shield) | |
| 395 | |||
| 396 | ✗ | { | |
| 397 | |||
| 398 | //arrays | ||
| 399 | |||
| 400 | ✗ | if(other.scrmem) | |
| 401 | { | ||
| 402 | ✗ | alloc_scriptmem(); | |
| 403 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 404 | |||
| 405 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 406 | ✗ | } | |
| 407 | ✗ | else scrmem = NULL; | |
| 408 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 409 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 410 | |||
| 411 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 412 | ✗ | defense[i]=other.defense[i]; | |
| 413 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 414 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 415 | |||
| 416 | ✗ | if(new_script_uid) | |
| 417 | { | ||
| 418 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 419 | ✗ | } | |
| 420 | ✗ | if(clear_parent_script_UID) | |
| 421 | { | ||
| 422 | ✗ | parent_script_UID = 0; | |
| 423 | ✗ | } | |
| 424 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 425 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 426 | |||
| 427 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 428 | { | ||
| 429 | ✗ | initD[q] = other.initD[q]; | |
| 430 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 431 | ✗ | } | |
| 432 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 433 | { | ||
| 434 | ✗ | initA[q] = other.initA[q]; | |
| 435 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 436 | ✗ | } | |
| 437 | ✗ | } | |
| 438 | |||
| 439 | |||
| 440 | |||
| 441 | |||
| 442 | ✗ | eScript::eScript(eScript const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 443 | //Struct Element Type Purpose | ||
| 444 | //sprite(other), | ||
| 445 | ✗ | enemy(other), | |
| 446 | ✗ | clk4(other.clk4), | |
| 447 | ✗ | shield(other.shield) | |
| 448 | |||
| 449 | ✗ | { | |
| 450 | |||
| 451 | //arrays | ||
| 452 | |||
| 453 | ✗ | if(other.scrmem) | |
| 454 | { | ||
| 455 | ✗ | alloc_scriptmem(); | |
| 456 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 457 | |||
| 458 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 459 | ✗ | } | |
| 460 | ✗ | else scrmem = NULL; | |
| 461 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 462 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 463 | |||
| 464 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 465 | ✗ | defense[i]=other.defense[i]; | |
| 466 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 467 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 468 | |||
| 469 | ✗ | if(new_script_uid) | |
| 470 | { | ||
| 471 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 472 | ✗ | } | |
| 473 | ✗ | if(clear_parent_script_UID) | |
| 474 | { | ||
| 475 | ✗ | parent_script_UID = 0; | |
| 476 | ✗ | } | |
| 477 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 478 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 479 | |||
| 480 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 481 | { | ||
| 482 | ✗ | initD[q] = other.initD[q]; | |
| 483 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 484 | ✗ | } | |
| 485 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 486 | { | ||
| 487 | ✗ | initA[q] = other.initA[q]; | |
| 488 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 489 | ✗ | } | |
| 490 | ✗ | } | |
| 491 | |||
| 492 | ✗ | eFriendly::eFriendly(eFriendly const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 493 | //Struct Element Type Purpose | ||
| 494 | //sprite(other), | ||
| 495 | ✗ | enemy(other), | |
| 496 | ✗ | clk4(other.clk4), | |
| 497 | ✗ | shield(other.shield) | |
| 498 | |||
| 499 | ✗ | { | |
| 500 | |||
| 501 | //arrays | ||
| 502 | |||
| 503 | ✗ | if(other.scrmem) | |
| 504 | { | ||
| 505 | ✗ | alloc_scriptmem(); | |
| 506 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 507 | |||
| 508 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 509 | ✗ | } | |
| 510 | ✗ | else scrmem = NULL; | |
| 511 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 512 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 513 | |||
| 514 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 515 | ✗ | defense[i]=other.defense[i]; | |
| 516 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 517 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 518 | |||
| 519 | ✗ | if(new_script_uid) | |
| 520 | { | ||
| 521 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 522 | ✗ | } | |
| 523 | ✗ | if(clear_parent_script_UID) | |
| 524 | { | ||
| 525 | ✗ | parent_script_UID = 0; | |
| 526 | ✗ | } | |
| 527 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 528 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 529 | |||
| 530 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 531 | { | ||
| 532 | ✗ | initD[q] = other.initD[q]; | |
| 533 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 534 | ✗ | } | |
| 535 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 536 | { | ||
| 537 | ✗ | initA[q] = other.initA[q]; | |
| 538 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 539 | ✗ | } | |
| 540 | ✗ | } | |
| 541 | |||
| 542 | ✗ | eGhini::eGhini(eGhini const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 543 | //Struct Element Type Purpose | ||
| 544 | //sprite(other), | ||
| 545 | ✗ | enemy(other), | |
| 546 | ✗ | clk4(other.clk4), | |
| 547 | ✗ | ox(other.ox), | |
| 548 | ✗ | oy(other.oy), | |
| 549 | ✗ | c(other.c) | |
| 550 | |||
| 551 | ✗ | { | |
| 552 | |||
| 553 | //arrays | ||
| 554 | |||
| 555 | ✗ | if(other.scrmem) | |
| 556 | { | ||
| 557 | ✗ | alloc_scriptmem(); | |
| 558 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 559 | |||
| 560 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 561 | ✗ | } | |
| 562 | ✗ | else scrmem = NULL; | |
| 563 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 564 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 565 | |||
| 566 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 567 | ✗ | defense[i]=other.defense[i]; | |
| 568 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 569 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 570 | |||
| 571 | ✗ | if(new_script_uid) | |
| 572 | { | ||
| 573 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 574 | ✗ | } | |
| 575 | ✗ | if(clear_parent_script_UID) | |
| 576 | { | ||
| 577 | ✗ | parent_script_UID = 0; | |
| 578 | ✗ | } | |
| 579 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 580 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 581 | |||
| 582 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 583 | { | ||
| 584 | ✗ | initD[q] = other.initD[q]; | |
| 585 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 586 | ✗ | } | |
| 587 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 588 | { | ||
| 589 | ✗ | initA[q] = other.initA[q]; | |
| 590 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 591 | ✗ | } | |
| 592 | ✗ | } | |
| 593 | |||
| 594 | ✗ | eTektite::eTektite(eTektite const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 595 | //Struct Element Type Purpose | ||
| 596 | //sprite(other), | ||
| 597 | ✗ | enemy(other), | |
| 598 | ✗ | old_y(other.old_y), | |
| 599 | ✗ | clk2start(other.clk2start), | |
| 600 | ✗ | cstart(other.cstart), | |
| 601 | ✗ | c(other.c) | |
| 602 | |||
| 603 | ✗ | { | |
| 604 | |||
| 605 | //arrays | ||
| 606 | |||
| 607 | ✗ | if(other.scrmem) | |
| 608 | { | ||
| 609 | ✗ | alloc_scriptmem(); | |
| 610 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 611 | |||
| 612 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 613 | ✗ | } | |
| 614 | ✗ | else scrmem = NULL; | |
| 615 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 616 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 617 | |||
| 618 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 619 | ✗ | defense[i]=other.defense[i]; | |
| 620 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 621 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 622 | |||
| 623 | ✗ | if(new_script_uid) | |
| 624 | { | ||
| 625 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 626 | ✗ | } | |
| 627 | ✗ | if(clear_parent_script_UID) | |
| 628 | { | ||
| 629 | ✗ | parent_script_UID = 0; | |
| 630 | ✗ | } | |
| 631 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 632 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 633 | |||
| 634 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 635 | { | ||
| 636 | ✗ | initD[q] = other.initD[q]; | |
| 637 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 638 | ✗ | } | |
| 639 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 640 | { | ||
| 641 | ✗ | initA[q] = other.initA[q]; | |
| 642 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 643 | ✗ | } | |
| 644 | ✗ | } | |
| 645 | |||
| 646 | ✗ | eItemFairy::eItemFairy(eItemFairy const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 647 | //Struct Element Type Purpose | ||
| 648 | //sprite(other), | ||
| 649 | ✗ | enemy(other) | |
| 650 | ✗ | { | |
| 651 | |||
| 652 | //arrays | ||
| 653 | |||
| 654 | ✗ | if(other.scrmem) | |
| 655 | { | ||
| 656 | ✗ | alloc_scriptmem(); | |
| 657 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 658 | |||
| 659 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 660 | ✗ | } | |
| 661 | ✗ | else scrmem = NULL; | |
| 662 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 663 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 664 | |||
| 665 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 666 | ✗ | defense[i]=other.defense[i]; | |
| 667 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 668 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 669 | |||
| 670 | ✗ | if(new_script_uid) | |
| 671 | { | ||
| 672 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 673 | ✗ | } | |
| 674 | ✗ | if(clear_parent_script_UID) | |
| 675 | { | ||
| 676 | ✗ | parent_script_UID = 0; | |
| 677 | ✗ | } | |
| 678 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 679 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 680 | |||
| 681 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 682 | { | ||
| 683 | ✗ | initD[q] = other.initD[q]; | |
| 684 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 685 | ✗ | } | |
| 686 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 687 | { | ||
| 688 | ✗ | initA[q] = other.initA[q]; | |
| 689 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 690 | ✗ | } | |
| 691 | ✗ | } | |
| 692 | |||
| 693 | ✗ | ePeahat::ePeahat(ePeahat const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 694 | //Struct Element Type Purpose | ||
| 695 | //sprite(other), | ||
| 696 | ✗ | enemy(other), | |
| 697 | ✗ | ox(other.ox), | |
| 698 | ✗ | oy(other.oy), | |
| 699 | ✗ | c(other.c) | |
| 700 | ✗ | { | |
| 701 | |||
| 702 | //arrays | ||
| 703 | |||
| 704 | ✗ | if(other.scrmem) | |
| 705 | { | ||
| 706 | ✗ | alloc_scriptmem(); | |
| 707 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 708 | |||
| 709 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 710 | ✗ | } | |
| 711 | ✗ | else scrmem = NULL; | |
| 712 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 713 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 714 | |||
| 715 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 716 | ✗ | defense[i]=other.defense[i]; | |
| 717 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 718 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 719 | |||
| 720 | ✗ | if(new_script_uid) | |
| 721 | { | ||
| 722 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 723 | ✗ | } | |
| 724 | ✗ | if(clear_parent_script_UID) | |
| 725 | { | ||
| 726 | ✗ | parent_script_UID = 0; | |
| 727 | ✗ | } | |
| 728 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 729 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 730 | |||
| 731 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 732 | { | ||
| 733 | ✗ | initD[q] = other.initD[q]; | |
| 734 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 735 | ✗ | } | |
| 736 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 737 | { | ||
| 738 | ✗ | initA[q] = other.initA[q]; | |
| 739 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 740 | ✗ | } | |
| 741 | ✗ | } | |
| 742 | |||
| 743 | ✗ | eLeever::eLeever(eLeever const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 744 | //Struct Element Type Purpose | ||
| 745 | //sprite(other), | ||
| 746 | ✗ | enemy(other), | |
| 747 | ✗ | temprule(other.temprule) | |
| 748 | ✗ | { | |
| 749 | |||
| 750 | //arrays | ||
| 751 | |||
| 752 | ✗ | if(other.scrmem) | |
| 753 | { | ||
| 754 | ✗ | alloc_scriptmem(); | |
| 755 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 756 | |||
| 757 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 758 | ✗ | } | |
| 759 | ✗ | else scrmem = NULL; | |
| 760 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 761 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 762 | |||
| 763 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 764 | ✗ | defense[i]=other.defense[i]; | |
| 765 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 766 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 767 | |||
| 768 | ✗ | if(new_script_uid) | |
| 769 | { | ||
| 770 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 771 | ✗ | } | |
| 772 | ✗ | if(clear_parent_script_UID) | |
| 773 | { | ||
| 774 | ✗ | parent_script_UID = 0; | |
| 775 | ✗ | } | |
| 776 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 777 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 778 | |||
| 779 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 780 | { | ||
| 781 | ✗ | initD[q] = other.initD[q]; | |
| 782 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 783 | ✗ | } | |
| 784 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 785 | { | ||
| 786 | ✗ | initA[q] = other.initA[q]; | |
| 787 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 788 | ✗ | } | |
| 789 | ✗ | } | |
| 790 | |||
| 791 | ✗ | eWallM::eWallM(eWallM const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 792 | //Struct Element Type Purpose | ||
| 793 | //sprite(other), | ||
| 794 | ✗ | enemy(other) | |
| 795 | ✗ | { | |
| 796 | |||
| 797 | //arrays | ||
| 798 | |||
| 799 | ✗ | if(other.scrmem) | |
| 800 | { | ||
| 801 | ✗ | alloc_scriptmem(); | |
| 802 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 803 | |||
| 804 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 805 | ✗ | } | |
| 806 | ✗ | else scrmem = NULL; | |
| 807 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 808 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 809 | |||
| 810 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 811 | ✗ | defense[i]=other.defense[i]; | |
| 812 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 813 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 814 | |||
| 815 | ✗ | if(new_script_uid) | |
| 816 | { | ||
| 817 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 818 | ✗ | } | |
| 819 | ✗ | if(clear_parent_script_UID) | |
| 820 | { | ||
| 821 | ✗ | parent_script_UID = 0; | |
| 822 | ✗ | } | |
| 823 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 824 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 825 | |||
| 826 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 827 | { | ||
| 828 | ✗ | initD[q] = other.initD[q]; | |
| 829 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 830 | ✗ | } | |
| 831 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 832 | { | ||
| 833 | ✗ | initA[q] = other.initA[q]; | |
| 834 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 835 | ✗ | } | |
| 836 | ✗ | } | |
| 837 | |||
| 838 | ✗ | eStalfos::eStalfos(eStalfos const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 839 | //Struct Element Type Purpose | ||
| 840 | //sprite(other), | ||
| 841 | ✗ | enemy(other), | |
| 842 | ✗ | clk4(other.clk4), | |
| 843 | ✗ | clk5(other.clk5), | |
| 844 | ✗ | fired(other.fired), | |
| 845 | ✗ | shield(other.shield), | |
| 846 | ✗ | dashing(other.dashing), | |
| 847 | ✗ | multishot(other.multishot), | |
| 848 | ✗ | fy(other.fy), | |
| 849 | ✗ | shadowdistance(other.shadowdistance) | |
| 850 | ✗ | { | |
| 851 | |||
| 852 | //arrays | ||
| 853 | |||
| 854 | ✗ | if(other.scrmem) | |
| 855 | { | ||
| 856 | ✗ | alloc_scriptmem(); | |
| 857 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 858 | |||
| 859 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 860 | ✗ | } | |
| 861 | ✗ | else scrmem = NULL; | |
| 862 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 863 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 864 | |||
| 865 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 866 | ✗ | defense[i]=other.defense[i]; | |
| 867 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 868 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 869 | |||
| 870 | ✗ | if(new_script_uid) | |
| 871 | { | ||
| 872 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 873 | ✗ | } | |
| 874 | ✗ | if(clear_parent_script_UID) | |
| 875 | { | ||
| 876 | ✗ | parent_script_UID = 0; | |
| 877 | ✗ | } | |
| 878 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 879 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 880 | |||
| 881 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 882 | { | ||
| 883 | ✗ | initD[q] = other.initD[q]; | |
| 884 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 885 | ✗ | } | |
| 886 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 887 | { | ||
| 888 | ✗ | initA[q] = other.initA[q]; | |
| 889 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 890 | ✗ | } | |
| 891 | ✗ | } | |
| 892 | |||
| 893 | ✗ | eZora::eZora(eZora const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 894 | //Struct Element Type Purpose | ||
| 895 | //sprite(other), | ||
| 896 | ✗ | enemy(other) | |
| 897 | ✗ | { | |
| 898 | |||
| 899 | //arrays | ||
| 900 | |||
| 901 | ✗ | if(other.scrmem) | |
| 902 | { | ||
| 903 | ✗ | alloc_scriptmem(); | |
| 904 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 905 | |||
| 906 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 907 | ✗ | } | |
| 908 | ✗ | else scrmem = NULL; | |
| 909 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 910 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 911 | |||
| 912 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 913 | ✗ | defense[i]=other.defense[i]; | |
| 914 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 915 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 916 | |||
| 917 | ✗ | if(new_script_uid) | |
| 918 | { | ||
| 919 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 920 | ✗ | } | |
| 921 | ✗ | if(clear_parent_script_UID) | |
| 922 | { | ||
| 923 | ✗ | parent_script_UID = 0; | |
| 924 | ✗ | } | |
| 925 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 926 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 927 | |||
| 928 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 929 | { | ||
| 930 | ✗ | initD[q] = other.initD[q]; | |
| 931 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 932 | ✗ | } | |
| 933 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 934 | { | ||
| 935 | ✗ | initA[q] = other.initA[q]; | |
| 936 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 937 | ✗ | } | |
| 938 | ✗ | } | |
| 939 | |||
| 940 | ✗ | eSpinTile::eSpinTile(eSpinTile const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 941 | //Struct Element Type Purpose | ||
| 942 | //sprite(other), | ||
| 943 | ✗ | enemy(other) | |
| 944 | ✗ | { | |
| 945 | |||
| 946 | //arrays | ||
| 947 | |||
| 948 | ✗ | if(other.scrmem) | |
| 949 | { | ||
| 950 | ✗ | alloc_scriptmem(); | |
| 951 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 952 | |||
| 953 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 954 | ✗ | } | |
| 955 | ✗ | else scrmem = NULL; | |
| 956 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 957 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 958 | |||
| 959 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 960 | ✗ | defense[i]=other.defense[i]; | |
| 961 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 962 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 963 | |||
| 964 | ✗ | if(new_script_uid) | |
| 965 | { | ||
| 966 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 967 | ✗ | } | |
| 968 | ✗ | if(clear_parent_script_UID) | |
| 969 | { | ||
| 970 | ✗ | parent_script_UID = 0; | |
| 971 | ✗ | } | |
| 972 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 973 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 974 | |||
| 975 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 976 | { | ||
| 977 | ✗ | initD[q] = other.initD[q]; | |
| 978 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 979 | ✗ | } | |
| 980 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 981 | { | ||
| 982 | ✗ | initA[q] = other.initA[q]; | |
| 983 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 984 | ✗ | } | |
| 985 | ✗ | } | |
| 986 | |||
| 987 | ✗ | eNPC::eNPC(eNPC const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 988 | //Struct Element Type Purpose | ||
| 989 | //sprite(other), | ||
| 990 | ✗ | enemy(other) | |
| 991 | ✗ | { | |
| 992 | |||
| 993 | //arrays | ||
| 994 | |||
| 995 | ✗ | if(other.scrmem) | |
| 996 | { | ||
| 997 | ✗ | alloc_scriptmem(); | |
| 998 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 999 | |||
| 1000 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1001 | ✗ | } | |
| 1002 | ✗ | else scrmem = NULL; | |
| 1003 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1004 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1005 | |||
| 1006 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1007 | ✗ | defense[i]=other.defense[i]; | |
| 1008 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1009 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1010 | |||
| 1011 | ✗ | if(new_script_uid) | |
| 1012 | { | ||
| 1013 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1014 | ✗ | } | |
| 1015 | ✗ | if(clear_parent_script_UID) | |
| 1016 | { | ||
| 1017 | ✗ | parent_script_UID = 0; | |
| 1018 | ✗ | } | |
| 1019 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1020 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1021 | |||
| 1022 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1023 | { | ||
| 1024 | ✗ | initD[q] = other.initD[q]; | |
| 1025 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1026 | ✗ | } | |
| 1027 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1028 | { | ||
| 1029 | ✗ | initA[q] = other.initA[q]; | |
| 1030 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1031 | ✗ | } | |
| 1032 | ✗ | } | |
| 1033 | |||
| 1034 | ✗ | eTrigger::eTrigger(eTrigger const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1035 | //Struct Element Type Purpose | ||
| 1036 | //sprite(other), | ||
| 1037 | ✗ | enemy(other) | |
| 1038 | ✗ | { | |
| 1039 | |||
| 1040 | //arrays | ||
| 1041 | |||
| 1042 | ✗ | if(other.scrmem) | |
| 1043 | { | ||
| 1044 | ✗ | alloc_scriptmem(); | |
| 1045 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1046 | |||
| 1047 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1048 | ✗ | } | |
| 1049 | ✗ | else scrmem = NULL; | |
| 1050 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1051 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1052 | |||
| 1053 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1054 | ✗ | defense[i]=other.defense[i]; | |
| 1055 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1056 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1057 | |||
| 1058 | ✗ | if(new_script_uid) | |
| 1059 | { | ||
| 1060 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1061 | ✗ | } | |
| 1062 | ✗ | if(clear_parent_script_UID) | |
| 1063 | { | ||
| 1064 | ✗ | parent_script_UID = 0; | |
| 1065 | ✗ | } | |
| 1066 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1067 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1068 | |||
| 1069 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1070 | { | ||
| 1071 | ✗ | initD[q] = other.initD[q]; | |
| 1072 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1073 | ✗ | } | |
| 1074 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1075 | { | ||
| 1076 | ✗ | initA[q] = other.initA[q]; | |
| 1077 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1078 | ✗ | } | |
| 1079 | ✗ | } | |
| 1080 | |||
| 1081 | ✗ | eProjectile::eProjectile(eProjectile const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1082 | //Struct Element Type Purpose | ||
| 1083 | //sprite(other), | ||
| 1084 | ✗ | enemy(other), | |
| 1085 | ✗ | minRange(other.minRange) | |
| 1086 | ✗ | { | |
| 1087 | |||
| 1088 | //arrays | ||
| 1089 | |||
| 1090 | ✗ | if(other.scrmem) | |
| 1091 | { | ||
| 1092 | ✗ | alloc_scriptmem(); | |
| 1093 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1094 | |||
| 1095 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1096 | ✗ | } | |
| 1097 | ✗ | else scrmem = NULL; | |
| 1098 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1099 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1100 | |||
| 1101 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1102 | ✗ | defense[i]=other.defense[i]; | |
| 1103 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1104 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1105 | |||
| 1106 | ✗ | if(new_script_uid) | |
| 1107 | { | ||
| 1108 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1109 | ✗ | } | |
| 1110 | ✗ | if(clear_parent_script_UID) | |
| 1111 | { | ||
| 1112 | ✗ | parent_script_UID = 0; | |
| 1113 | ✗ | } | |
| 1114 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1115 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1116 | |||
| 1117 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1118 | { | ||
| 1119 | ✗ | initD[q] = other.initD[q]; | |
| 1120 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1121 | ✗ | } | |
| 1122 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1123 | { | ||
| 1124 | ✗ | initA[q] = other.initA[q]; | |
| 1125 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1126 | ✗ | } | |
| 1127 | ✗ | } | |
| 1128 | |||
| 1129 | ✗ | eBoulder::eBoulder(eBoulder const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1130 | //Struct Element Type Purpose | ||
| 1131 | //sprite(other), | ||
| 1132 | ✗ | enemy(other) | |
| 1133 | ✗ | { | |
| 1134 | |||
| 1135 | //arrays | ||
| 1136 | |||
| 1137 | ✗ | if(other.scrmem) | |
| 1138 | { | ||
| 1139 | ✗ | alloc_scriptmem(); | |
| 1140 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1141 | |||
| 1142 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1143 | ✗ | } | |
| 1144 | ✗ | else scrmem = NULL; | |
| 1145 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1146 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1147 | |||
| 1148 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1149 | ✗ | defense[i]=other.defense[i]; | |
| 1150 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1151 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1152 | |||
| 1153 | ✗ | if(new_script_uid) | |
| 1154 | { | ||
| 1155 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1156 | ✗ | } | |
| 1157 | ✗ | if(clear_parent_script_UID) | |
| 1158 | { | ||
| 1159 | ✗ | parent_script_UID = 0; | |
| 1160 | ✗ | } | |
| 1161 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1162 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1163 | |||
| 1164 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1165 | { | ||
| 1166 | ✗ | initD[q] = other.initD[q]; | |
| 1167 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1168 | ✗ | } | |
| 1169 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1170 | { | ||
| 1171 | ✗ | initA[q] = other.initA[q]; | |
| 1172 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1173 | ✗ | } | |
| 1174 | ✗ | } | |
| 1175 | |||
| 1176 | ✗ | eRock::eRock(eRock const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1177 | //Struct Element Type Purpose | ||
| 1178 | //sprite(other), | ||
| 1179 | ✗ | enemy(other) | |
| 1180 | ✗ | { | |
| 1181 | |||
| 1182 | //arrays | ||
| 1183 | |||
| 1184 | ✗ | if(other.scrmem) | |
| 1185 | { | ||
| 1186 | ✗ | alloc_scriptmem(); | |
| 1187 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1188 | |||
| 1189 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1190 | ✗ | } | |
| 1191 | ✗ | else scrmem = NULL; | |
| 1192 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1193 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1194 | |||
| 1195 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1196 | ✗ | defense[i]=other.defense[i]; | |
| 1197 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1198 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1199 | |||
| 1200 | ✗ | if(new_script_uid) | |
| 1201 | { | ||
| 1202 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1203 | ✗ | } | |
| 1204 | ✗ | if(clear_parent_script_UID) | |
| 1205 | { | ||
| 1206 | ✗ | parent_script_UID = 0; | |
| 1207 | ✗ | } | |
| 1208 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1209 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1210 | |||
| 1211 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1212 | { | ||
| 1213 | ✗ | initD[q] = other.initD[q]; | |
| 1214 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1215 | ✗ | } | |
| 1216 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1217 | { | ||
| 1218 | ✗ | initA[q] = other.initA[q]; | |
| 1219 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1220 | ✗ | } | |
| 1221 | ✗ | } | |
| 1222 | |||
| 1223 | ✗ | eTrap2::eTrap2(eTrap2 const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1224 | //Struct Element Type Purpose | ||
| 1225 | //sprite(other), | ||
| 1226 | ✗ | enemy(other) | |
| 1227 | ✗ | { | |
| 1228 | |||
| 1229 | //arrays | ||
| 1230 | |||
| 1231 | ✗ | if(other.scrmem) | |
| 1232 | { | ||
| 1233 | ✗ | alloc_scriptmem(); | |
| 1234 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1235 | |||
| 1236 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1237 | ✗ | } | |
| 1238 | ✗ | else scrmem = NULL; | |
| 1239 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1240 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1241 | |||
| 1242 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1243 | ✗ | defense[i]=other.defense[i]; | |
| 1244 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1245 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1246 | |||
| 1247 | ✗ | if(new_script_uid) | |
| 1248 | { | ||
| 1249 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1250 | ✗ | } | |
| 1251 | ✗ | if(clear_parent_script_UID) | |
| 1252 | { | ||
| 1253 | ✗ | parent_script_UID = 0; | |
| 1254 | ✗ | } | |
| 1255 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1256 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1257 | |||
| 1258 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1259 | { | ||
| 1260 | ✗ | initD[q] = other.initD[q]; | |
| 1261 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1262 | ✗ | } | |
| 1263 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1264 | { | ||
| 1265 | ✗ | initA[q] = other.initA[q]; | |
| 1266 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1267 | ✗ | } | |
| 1268 | ✗ | } | |
| 1269 | |||
| 1270 | ✗ | eTrap::eTrap(eTrap const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1271 | //Struct Element Type Purpose | ||
| 1272 | //sprite(other), | ||
| 1273 | ✗ | enemy(other), | |
| 1274 | ✗ | ox(other.ox), | |
| 1275 | ✗ | oy(other.oy) | |
| 1276 | ✗ | { | |
| 1277 | |||
| 1278 | //arrays | ||
| 1279 | |||
| 1280 | ✗ | if(other.scrmem) | |
| 1281 | { | ||
| 1282 | ✗ | alloc_scriptmem(); | |
| 1283 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1284 | |||
| 1285 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1286 | ✗ | } | |
| 1287 | ✗ | else scrmem = NULL; | |
| 1288 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1289 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1290 | |||
| 1291 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1292 | ✗ | defense[i]=other.defense[i]; | |
| 1293 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1294 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1295 | |||
| 1296 | ✗ | if(new_script_uid) | |
| 1297 | { | ||
| 1298 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1299 | ✗ | } | |
| 1300 | ✗ | if(clear_parent_script_UID) | |
| 1301 | { | ||
| 1302 | ✗ | parent_script_UID = 0; | |
| 1303 | ✗ | } | |
| 1304 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1305 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1306 | |||
| 1307 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1308 | { | ||
| 1309 | ✗ | initD[q] = other.initD[q]; | |
| 1310 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1311 | ✗ | } | |
| 1312 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1313 | { | ||
| 1314 | ✗ | initA[q] = other.initA[q]; | |
| 1315 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1316 | ✗ | } | |
| 1317 | ✗ | } | |
| 1318 | |||
| 1319 | |||
| 1320 | |||
| 1321 | |||
| 1322 | ✗ | eKeese::eKeese(eKeese const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1323 | //Struct Element Type Purpose | ||
| 1324 | //sprite(other), | ||
| 1325 | ✗ | enemy(other), | |
| 1326 | ✗ | ox(other.ox), | |
| 1327 | ✗ | c(other.c), | |
| 1328 | ✗ | clk4(other.clk4), | |
| 1329 | ✗ | oy(other.oy) | |
| 1330 | ✗ | { | |
| 1331 | |||
| 1332 | //arrays | ||
| 1333 | |||
| 1334 | ✗ | if(other.scrmem) | |
| 1335 | { | ||
| 1336 | ✗ | alloc_scriptmem(); | |
| 1337 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1338 | |||
| 1339 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1340 | ✗ | } | |
| 1341 | ✗ | else scrmem = NULL; | |
| 1342 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1343 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1344 | |||
| 1345 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1346 | ✗ | defense[i]=other.defense[i]; | |
| 1347 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1348 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1349 | |||
| 1350 | ✗ | if(new_script_uid) | |
| 1351 | { | ||
| 1352 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1353 | ✗ | } | |
| 1354 | ✗ | if(clear_parent_script_UID) | |
| 1355 | { | ||
| 1356 | ✗ | parent_script_UID = 0; | |
| 1357 | ✗ | } | |
| 1358 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1359 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1360 | |||
| 1361 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1362 | { | ||
| 1363 | ✗ | initD[q] = other.initD[q]; | |
| 1364 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1365 | ✗ | } | |
| 1366 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1367 | { | ||
| 1368 | ✗ | initA[q] = other.initA[q]; | |
| 1369 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1370 | ✗ | } | |
| 1371 | ✗ | } | |
| 1372 | |||
| 1373 | ✗ | eWizzrobe::eWizzrobe(eWizzrobe const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1374 | //Struct Element Type Purpose | ||
| 1375 | //sprite(other), | ||
| 1376 | ✗ | enemy(other), | |
| 1377 | ✗ | charging(other.charging), | |
| 1378 | ✗ | firing(other.firing), | |
| 1379 | ✗ | fclk(other.fclk) | |
| 1380 | ✗ | { | |
| 1381 | |||
| 1382 | //arrays | ||
| 1383 | |||
| 1384 | ✗ | if(other.scrmem) | |
| 1385 | { | ||
| 1386 | ✗ | alloc_scriptmem(); | |
| 1387 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1388 | |||
| 1389 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1390 | ✗ | } | |
| 1391 | ✗ | else scrmem = NULL; | |
| 1392 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1393 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1394 | |||
| 1395 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1396 | ✗ | defense[i]=other.defense[i]; | |
| 1397 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1398 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1399 | |||
| 1400 | ✗ | if(new_script_uid) | |
| 1401 | { | ||
| 1402 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1403 | ✗ | } | |
| 1404 | ✗ | if(clear_parent_script_UID) | |
| 1405 | { | ||
| 1406 | ✗ | parent_script_UID = 0; | |
| 1407 | ✗ | } | |
| 1408 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1409 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1410 | |||
| 1411 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1412 | { | ||
| 1413 | ✗ | initD[q] = other.initD[q]; | |
| 1414 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1415 | ✗ | } | |
| 1416 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1417 | { | ||
| 1418 | ✗ | initA[q] = other.initA[q]; | |
| 1419 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1420 | ✗ | } | |
| 1421 | ✗ | } | |
| 1422 | |||
| 1423 | ✗ | eDodongo::eDodongo(eDodongo const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1424 | //Struct Element Type Purpose | ||
| 1425 | //sprite(other), | ||
| 1426 | ✗ | enemy(other) | |
| 1427 | ✗ | { | |
| 1428 | |||
| 1429 | //arrays | ||
| 1430 | |||
| 1431 | ✗ | if(other.scrmem) | |
| 1432 | { | ||
| 1433 | ✗ | alloc_scriptmem(); | |
| 1434 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1435 | |||
| 1436 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1437 | ✗ | } | |
| 1438 | ✗ | else scrmem = NULL; | |
| 1439 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1440 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1441 | |||
| 1442 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1443 | ✗ | defense[i]=other.defense[i]; | |
| 1444 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1445 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1446 | |||
| 1447 | ✗ | if(new_script_uid) | |
| 1448 | { | ||
| 1449 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1450 | ✗ | } | |
| 1451 | ✗ | if(clear_parent_script_UID) | |
| 1452 | { | ||
| 1453 | ✗ | parent_script_UID = 0; | |
| 1454 | ✗ | } | |
| 1455 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1456 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1457 | |||
| 1458 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1459 | { | ||
| 1460 | ✗ | initD[q] = other.initD[q]; | |
| 1461 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1462 | ✗ | } | |
| 1463 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1464 | { | ||
| 1465 | ✗ | initA[q] = other.initA[q]; | |
| 1466 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1467 | ✗ | } | |
| 1468 | ✗ | } | |
| 1469 | |||
| 1470 | ✗ | eDodongo2::eDodongo2(eDodongo2 const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1471 | //Struct Element Type Purpose | ||
| 1472 | //sprite(other), | ||
| 1473 | ✗ | enemy(other), | |
| 1474 | ✗ | previous_dir(other.previous_dir) | |
| 1475 | ✗ | { | |
| 1476 | |||
| 1477 | //arrays | ||
| 1478 | |||
| 1479 | ✗ | if(other.scrmem) | |
| 1480 | { | ||
| 1481 | ✗ | alloc_scriptmem(); | |
| 1482 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1483 | |||
| 1484 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1485 | ✗ | } | |
| 1486 | ✗ | else scrmem = NULL; | |
| 1487 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1488 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1489 | |||
| 1490 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1491 | ✗ | defense[i]=other.defense[i]; | |
| 1492 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1493 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1494 | |||
| 1495 | ✗ | if(new_script_uid) | |
| 1496 | { | ||
| 1497 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1498 | ✗ | } | |
| 1499 | ✗ | if(clear_parent_script_UID) | |
| 1500 | { | ||
| 1501 | ✗ | parent_script_UID = 0; | |
| 1502 | ✗ | } | |
| 1503 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1504 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1505 | |||
| 1506 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1507 | { | ||
| 1508 | ✗ | initD[q] = other.initD[q]; | |
| 1509 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1510 | ✗ | } | |
| 1511 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1512 | { | ||
| 1513 | ✗ | initA[q] = other.initA[q]; | |
| 1514 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1515 | ✗ | } | |
| 1516 | ✗ | } | |
| 1517 | |||
| 1518 | ✗ | eAquamentus::eAquamentus(eAquamentus const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1519 | //Struct Element Type Purpose | ||
| 1520 | //sprite(other), | ||
| 1521 | ✗ | enemy(other), | |
| 1522 | ✗ | fbx(other.fbx), | |
| 1523 | ✗ | clk4(other.clk4) | |
| 1524 | ✗ | { | |
| 1525 | |||
| 1526 | //arrays | ||
| 1527 | |||
| 1528 | ✗ | if(other.scrmem) | |
| 1529 | { | ||
| 1530 | ✗ | alloc_scriptmem(); | |
| 1531 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1532 | |||
| 1533 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1534 | ✗ | } | |
| 1535 | ✗ | else scrmem = NULL; | |
| 1536 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1537 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1538 | |||
| 1539 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1540 | ✗ | defense[i]=other.defense[i]; | |
| 1541 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1542 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1543 | |||
| 1544 | ✗ | if(new_script_uid) | |
| 1545 | { | ||
| 1546 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1547 | ✗ | } | |
| 1548 | ✗ | if(clear_parent_script_UID) | |
| 1549 | { | ||
| 1550 | ✗ | parent_script_UID = 0; | |
| 1551 | ✗ | } | |
| 1552 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1553 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1554 | |||
| 1555 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1556 | { | ||
| 1557 | ✗ | initD[q] = other.initD[q]; | |
| 1558 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1559 | ✗ | } | |
| 1560 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1561 | { | ||
| 1562 | ✗ | initA[q] = other.initA[q]; | |
| 1563 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1564 | ✗ | } | |
| 1565 | ✗ | } | |
| 1566 | |||
| 1567 | ✗ | eGohma::eGohma(eGohma const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1568 | //Struct Element Type Purpose | ||
| 1569 | //sprite(other), | ||
| 1570 | ✗ | enemy(other), | |
| 1571 | ✗ | clk4(other.clk4) | |
| 1572 | ✗ | { | |
| 1573 | |||
| 1574 | //arrays | ||
| 1575 | |||
| 1576 | ✗ | if(other.scrmem) | |
| 1577 | { | ||
| 1578 | ✗ | alloc_scriptmem(); | |
| 1579 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1580 | |||
| 1581 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1582 | ✗ | } | |
| 1583 | ✗ | else scrmem = NULL; | |
| 1584 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1585 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1586 | |||
| 1587 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1588 | ✗ | defense[i]=other.defense[i]; | |
| 1589 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1590 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1591 | |||
| 1592 | ✗ | if(new_script_uid) | |
| 1593 | { | ||
| 1594 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1595 | ✗ | } | |
| 1596 | ✗ | if(clear_parent_script_UID) | |
| 1597 | { | ||
| 1598 | ✗ | parent_script_UID = 0; | |
| 1599 | ✗ | } | |
| 1600 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1601 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1602 | |||
| 1603 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1604 | { | ||
| 1605 | ✗ | initD[q] = other.initD[q]; | |
| 1606 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1607 | ✗ | } | |
| 1608 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1609 | { | ||
| 1610 | ✗ | initA[q] = other.initA[q]; | |
| 1611 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1612 | ✗ | } | |
| 1613 | ✗ | } | |
| 1614 | |||
| 1615 | ✗ | eLilDig::eLilDig(eLilDig const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1616 | //Struct Element Type Purpose | ||
| 1617 | //sprite(other), | ||
| 1618 | ✗ | enemy(other) | |
| 1619 | ✗ | { | |
| 1620 | |||
| 1621 | //arrays | ||
| 1622 | |||
| 1623 | ✗ | if(other.scrmem) | |
| 1624 | { | ||
| 1625 | ✗ | alloc_scriptmem(); | |
| 1626 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1627 | |||
| 1628 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1629 | ✗ | } | |
| 1630 | ✗ | else scrmem = NULL; | |
| 1631 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1632 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1633 | |||
| 1634 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1635 | ✗ | defense[i]=other.defense[i]; | |
| 1636 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1637 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1638 | |||
| 1639 | ✗ | if(new_script_uid) | |
| 1640 | { | ||
| 1641 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1642 | ✗ | } | |
| 1643 | ✗ | if(clear_parent_script_UID) | |
| 1644 | { | ||
| 1645 | ✗ | parent_script_UID = 0; | |
| 1646 | ✗ | } | |
| 1647 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1648 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1649 | |||
| 1650 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1651 | { | ||
| 1652 | ✗ | initD[q] = other.initD[q]; | |
| 1653 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1654 | ✗ | } | |
| 1655 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1656 | { | ||
| 1657 | ✗ | initA[q] = other.initA[q]; | |
| 1658 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1659 | ✗ | } | |
| 1660 | ✗ | } | |
| 1661 | |||
| 1662 | ✗ | eBigDig::eBigDig(eBigDig const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1663 | //Struct Element Type Purpose | ||
| 1664 | //sprite(other), | ||
| 1665 | ✗ | enemy(other) | |
| 1666 | ✗ | { | |
| 1667 | |||
| 1668 | //arrays | ||
| 1669 | |||
| 1670 | ✗ | if(other.scrmem) | |
| 1671 | { | ||
| 1672 | ✗ | alloc_scriptmem(); | |
| 1673 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1674 | |||
| 1675 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1676 | ✗ | } | |
| 1677 | ✗ | else scrmem = NULL; | |
| 1678 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1679 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1680 | |||
| 1681 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1682 | ✗ | defense[i]=other.defense[i]; | |
| 1683 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1684 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1685 | |||
| 1686 | ✗ | if(new_script_uid) | |
| 1687 | { | ||
| 1688 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1689 | ✗ | } | |
| 1690 | ✗ | if(clear_parent_script_UID) | |
| 1691 | { | ||
| 1692 | ✗ | parent_script_UID = 0; | |
| 1693 | ✗ | } | |
| 1694 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1695 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1696 | |||
| 1697 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1698 | { | ||
| 1699 | ✗ | initD[q] = other.initD[q]; | |
| 1700 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1701 | ✗ | } | |
| 1702 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1703 | { | ||
| 1704 | ✗ | initA[q] = other.initA[q]; | |
| 1705 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1706 | ✗ | } | |
| 1707 | ✗ | } | |
| 1708 | |||
| 1709 | ✗ | eGanon::eGanon(eGanon const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1710 | //Struct Element Type Purpose | ||
| 1711 | //sprite(other), | ||
| 1712 | ✗ | enemy(other), | |
| 1713 | ✗ | Stunclk(other.Stunclk) | |
| 1714 | |||
| 1715 | ✗ | { | |
| 1716 | |||
| 1717 | //arrays | ||
| 1718 | |||
| 1719 | ✗ | if(other.scrmem) | |
| 1720 | { | ||
| 1721 | ✗ | alloc_scriptmem(); | |
| 1722 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1723 | |||
| 1724 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1725 | ✗ | } | |
| 1726 | ✗ | else scrmem = NULL; | |
| 1727 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1728 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1729 | |||
| 1730 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1731 | ✗ | defense[i]=other.defense[i]; | |
| 1732 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1733 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1734 | |||
| 1735 | ✗ | if(new_script_uid) | |
| 1736 | { | ||
| 1737 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1738 | ✗ | } | |
| 1739 | ✗ | if(clear_parent_script_UID) | |
| 1740 | { | ||
| 1741 | ✗ | parent_script_UID = 0; | |
| 1742 | ✗ | } | |
| 1743 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1744 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1745 | |||
| 1746 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1747 | { | ||
| 1748 | ✗ | initD[q] = other.initD[q]; | |
| 1749 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1750 | ✗ | } | |
| 1751 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1752 | { | ||
| 1753 | ✗ | initA[q] = other.initA[q]; | |
| 1754 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1755 | ✗ | } | |
| 1756 | ✗ | } | |
| 1757 | |||
| 1758 | ✗ | eMoldorm::eMoldorm(eMoldorm const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1759 | //Struct Element Type Purpose | ||
| 1760 | //sprite(other), | ||
| 1761 | ✗ | enemy(other), | |
| 1762 | ✗ | segcnt(other.segcnt), | |
| 1763 | ✗ | segid(other.segid) | |
| 1764 | |||
| 1765 | ✗ | { | |
| 1766 | |||
| 1767 | //arrays | ||
| 1768 | |||
| 1769 | ✗ | if(other.scrmem) | |
| 1770 | { | ||
| 1771 | ✗ | alloc_scriptmem(); | |
| 1772 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1773 | |||
| 1774 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1775 | ✗ | } | |
| 1776 | ✗ | else scrmem = NULL; | |
| 1777 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1778 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1779 | |||
| 1780 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1781 | ✗ | defense[i]=other.defense[i]; | |
| 1782 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1783 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1784 | |||
| 1785 | ✗ | if(new_script_uid) | |
| 1786 | { | ||
| 1787 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1788 | ✗ | } | |
| 1789 | ✗ | if(clear_parent_script_UID) | |
| 1790 | { | ||
| 1791 | ✗ | parent_script_UID = 0; | |
| 1792 | ✗ | } | |
| 1793 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1794 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1795 | |||
| 1796 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1797 | { | ||
| 1798 | ✗ | initD[q] = other.initD[q]; | |
| 1799 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1800 | ✗ | } | |
| 1801 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1802 | { | ||
| 1803 | ✗ | initA[q] = other.initA[q]; | |
| 1804 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1805 | ✗ | } | |
| 1806 | ✗ | } | |
| 1807 | |||
| 1808 | ✗ | esMoldorm::esMoldorm(esMoldorm const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 1809 | //Struct Element Type Purpose | ||
| 1810 | //sprite(other), | ||
| 1811 | ✗ | enemy(other), | |
| 1812 | ✗ | parentclk(other.parentclk) | |
| 1813 | ✗ | { | |
| 1814 | |||
| 1815 | //arrays | ||
| 1816 | |||
| 1817 | ✗ | if(other.scrmem) | |
| 1818 | { | ||
| 1819 | ✗ | alloc_scriptmem(); | |
| 1820 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 1821 | |||
| 1822 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 1823 | ✗ | } | |
| 1824 | ✗ | else scrmem = NULL; | |
| 1825 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1826 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1827 | |||
| 1828 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 1829 | ✗ | defense[i]=other.defense[i]; | |
| 1830 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 1831 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 1832 | |||
| 1833 | ✗ | if(new_script_uid) | |
| 1834 | { | ||
| 1835 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 1836 | ✗ | } | |
| 1837 | ✗ | if(clear_parent_script_UID) | |
| 1838 | { | ||
| 1839 | ✗ | parent_script_UID = 0; | |
| 1840 | ✗ | } | |
| 1841 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 1842 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 1843 | |||
| 1844 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 1845 | { | ||
| 1846 | ✗ | initD[q] = other.initD[q]; | |
| 1847 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 1848 | ✗ | } | |
| 1849 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 1850 | { | ||
| 1851 | ✗ | initA[q] = other.initA[q]; | |
| 1852 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 1853 | ✗ | } | |
| 1854 | ✗ | } | |
| 1855 | /* | ||
| 1856 | eManhandla::eManhandla(eManhandla const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 1857 | //Struct Element Type Purpose | ||
| 1858 | //sprite(other), | ||
| 1859 | enemy(other), | ||
| 1860 | armcnt(armcnt), | ||
| 1861 | adjusted(adjusted), | ||
| 1862 | arm[0](arm[0]), | ||
| 1863 | arm[1](arm[1]), | ||
| 1864 | arm[2](arm[2]), | ||
| 1865 | arm[3](arm[3]), | ||
| 1866 | arm[4](arm[4]), | ||
| 1867 | arm[5](arm[5]), | ||
| 1868 | arm[6](arm[6]), | ||
| 1869 | arm[7](arm[7]) | ||
| 1870 | { | ||
| 1871 | |||
| 1872 | //arrays | ||
| 1873 | if(other.scrmem) | ||
| 1874 | { | ||
| 1875 | alloc_scriptmem(); | ||
| 1876 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 1877 | |||
| 1878 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 1879 | } | ||
| 1880 | else scrmem = NULL; | ||
| 1881 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1882 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1883 | |||
| 1884 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 1885 | defense[i]=other.defense[i]; | ||
| 1886 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 1887 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 1888 | |||
| 1889 | if(new_script_uid) | ||
| 1890 | { | ||
| 1891 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 1892 | } | ||
| 1893 | if(clear_parent_script_UID) | ||
| 1894 | { | ||
| 1895 | parent_script_UID = 0; | ||
| 1896 | } | ||
| 1897 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 1898 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 1899 | |||
| 1900 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 1901 | { | ||
| 1902 | initD[q] = other.initD[q]; | ||
| 1903 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 1904 | } | ||
| 1905 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 1906 | { | ||
| 1907 | initA[q] = other.initA[q]; | ||
| 1908 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 1909 | } | ||
| 1910 | } | ||
| 1911 | |||
| 1912 | esManhandla::esManhandla(esManhandla const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 1913 | //Struct Element Type Purpose | ||
| 1914 | //sprite(other), | ||
| 1915 | enemy(other) | ||
| 1916 | { | ||
| 1917 | |||
| 1918 | //arrays | ||
| 1919 | if(other.scrmem) | ||
| 1920 | { | ||
| 1921 | alloc_scriptmem(); | ||
| 1922 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 1923 | |||
| 1924 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 1925 | } | ||
| 1926 | else scrmem = NULL; | ||
| 1927 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1928 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1929 | |||
| 1930 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 1931 | defense[i]=other.defense[i]; | ||
| 1932 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 1933 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 1934 | |||
| 1935 | if(new_script_uid) | ||
| 1936 | { | ||
| 1937 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 1938 | } | ||
| 1939 | if(clear_parent_script_UID) | ||
| 1940 | { | ||
| 1941 | parent_script_UID = 0; | ||
| 1942 | } | ||
| 1943 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 1944 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 1945 | |||
| 1946 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 1947 | { | ||
| 1948 | initD[q] = other.initD[q]; | ||
| 1949 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 1950 | } | ||
| 1951 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 1952 | { | ||
| 1953 | initA[q] = other.initA[q]; | ||
| 1954 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 1955 | } | ||
| 1956 | } | ||
| 1957 | |||
| 1958 | eGleeok::eGleeok(eGleeok const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 1959 | //Struct Element Type Purpose | ||
| 1960 | //sprite(other), | ||
| 1961 | enemy(other), | ||
| 1962 | flameclk(flameclk), | ||
| 1963 | flamehead(flamehead), | ||
| 1964 | necktile(necktile) | ||
| 1965 | |||
| 1966 | { | ||
| 1967 | |||
| 1968 | //arrays | ||
| 1969 | |||
| 1970 | if(other.scrmem) | ||
| 1971 | { | ||
| 1972 | alloc_scriptmem(); | ||
| 1973 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 1974 | |||
| 1975 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 1976 | } | ||
| 1977 | else scrmem = NULL; | ||
| 1978 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 1979 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 1980 | |||
| 1981 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 1982 | defense[i]=other.defense[i]; | ||
| 1983 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 1984 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 1985 | |||
| 1986 | if(new_script_uid) | ||
| 1987 | { | ||
| 1988 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 1989 | } | ||
| 1990 | if(clear_parent_script_UID) | ||
| 1991 | { | ||
| 1992 | parent_script_UID = 0; | ||
| 1993 | } | ||
| 1994 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 1995 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 1996 | |||
| 1997 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 1998 | { | ||
| 1999 | initD[q] = other.initD[q]; | ||
| 2000 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 2001 | } | ||
| 2002 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 2003 | { | ||
| 2004 | initA[q] = other.initA[q]; | ||
| 2005 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 2006 | } | ||
| 2007 | } | ||
| 2008 | |||
| 2009 | esGleeok::esGleeok(esGleeok const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 2010 | //Struct Element Type Purpose | ||
| 2011 | //sprite(other), | ||
| 2012 | enemy(other), | ||
| 2013 | headtile(headtile), | ||
| 2014 | flyingheadtile(flyingheadtile), | ||
| 2015 | necktile(necktile), | ||
| 2016 | xoffset(xoffset), | ||
| 2017 | yoffset(yoffset), | ||
| 2018 | nx(nx), | ||
| 2019 | ny(ny), | ||
| 2020 | nxoffset(nxoffset), | ||
| 2021 | nyoffset(nyoffset), | ||
| 2022 | parent(parent) | ||
| 2023 | |||
| 2024 | { | ||
| 2025 | |||
| 2026 | //arrays | ||
| 2027 | |||
| 2028 | if(other.scrmem) | ||
| 2029 | { | ||
| 2030 | alloc_scriptmem(); | ||
| 2031 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 2032 | |||
| 2033 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 2034 | } | ||
| 2035 | else scrmem = NULL; | ||
| 2036 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 2037 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 2038 | |||
| 2039 | //for ( int32_t q = 0; q < 255; q++ ) | ||
| 2040 | //{ | ||
| 2041 | // nx[q] = other.nx[q]; | ||
| 2042 | // ny[q] = other.ny[q]; | ||
| 2043 | // nxoffset[q] = other.nxoffset[q]; | ||
| 2044 | // nyoffset[q] = other.nyoffset[q]; | ||
| 2045 | //} | ||
| 2046 | |||
| 2047 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 2048 | defense[i]=other.defense[i]; | ||
| 2049 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 2050 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 2051 | |||
| 2052 | if(new_script_uid) | ||
| 2053 | { | ||
| 2054 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 2055 | } | ||
| 2056 | if(clear_parent_script_UID) | ||
| 2057 | { | ||
| 2058 | parent_script_UID = 0; | ||
| 2059 | } | ||
| 2060 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 2061 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 2062 | |||
| 2063 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 2064 | { | ||
| 2065 | initD[q] = other.initD[q]; | ||
| 2066 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 2067 | } | ||
| 2068 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 2069 | { | ||
| 2070 | initA[q] = other.initA[q]; | ||
| 2071 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 2072 | } | ||
| 2073 | } | ||
| 2074 | |||
| 2075 | ePatra::ePatra(ePatra const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 2076 | //Struct Element Type Purpose | ||
| 2077 | //sprite(other), | ||
| 2078 | enemy(other), | ||
| 2079 | flycnt(flycnt), | ||
| 2080 | flycnt2(flycnt2), | ||
| 2081 | loopcnt(loopcnt), | ||
| 2082 | lookat(lookat), | ||
| 2083 | circle_x(circle_x), | ||
| 2084 | circle_y(circle_y), | ||
| 2085 | temp_x(temp_x), | ||
| 2086 | temp_y(temp_y), | ||
| 2087 | adjusted(adjusted) | ||
| 2088 | |||
| 2089 | { | ||
| 2090 | |||
| 2091 | //arrays | ||
| 2092 | |||
| 2093 | if(other.scrmem) | ||
| 2094 | { | ||
| 2095 | alloc_scriptmem(); | ||
| 2096 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 2097 | |||
| 2098 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 2099 | } | ||
| 2100 | else scrmem = NULL; | ||
| 2101 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 2102 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 2103 | |||
| 2104 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 2105 | defense[i]=other.defense[i]; | ||
| 2106 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 2107 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 2108 | |||
| 2109 | if(new_script_uid) | ||
| 2110 | { | ||
| 2111 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 2112 | } | ||
| 2113 | if(clear_parent_script_UID) | ||
| 2114 | { | ||
| 2115 | parent_script_UID = 0; | ||
| 2116 | } | ||
| 2117 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 2118 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 2119 | |||
| 2120 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 2121 | { | ||
| 2122 | initD[q] = other.initD[q]; | ||
| 2123 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 2124 | } | ||
| 2125 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 2126 | { | ||
| 2127 | initA[q] = other.initA[q]; | ||
| 2128 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 2129 | } | ||
| 2130 | } | ||
| 2131 | |||
| 2132 | ePatraBS::ePatraBS(ePatraBS const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 2133 | //Struct Element Type Purpose | ||
| 2134 | //sprite(other), | ||
| 2135 | enemy(other), | ||
| 2136 | flycnt(flycnt), | ||
| 2137 | flycnt2(flycnt2), | ||
| 2138 | loopcnt(loopcnt), | ||
| 2139 | lookat(lookat), | ||
| 2140 | adjusted(adjusted) | ||
| 2141 | |||
| 2142 | { | ||
| 2143 | |||
| 2144 | //arrays | ||
| 2145 | |||
| 2146 | if(other.scrmem) | ||
| 2147 | { | ||
| 2148 | alloc_scriptmem(); | ||
| 2149 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 2150 | |||
| 2151 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 2152 | } | ||
| 2153 | else scrmem = NULL; | ||
| 2154 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 2155 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 2156 | |||
| 2157 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 2158 | defense[i]=other.defense[i]; | ||
| 2159 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 2160 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 2161 | |||
| 2162 | if(new_script_uid) | ||
| 2163 | { | ||
| 2164 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 2165 | } | ||
| 2166 | if(clear_parent_script_UID) | ||
| 2167 | { | ||
| 2168 | parent_script_UID = 0; | ||
| 2169 | } | ||
| 2170 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 2171 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 2172 | |||
| 2173 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 2174 | { | ||
| 2175 | initD[q] = other.initD[q]; | ||
| 2176 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 2177 | } | ||
| 2178 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 2179 | { | ||
| 2180 | initA[q] = other.initA[q]; | ||
| 2181 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 2182 | } | ||
| 2183 | } | ||
| 2184 | |||
| 2185 | esPatra::esPatra(esPatra const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 2186 | //Struct Element Type Purpose | ||
| 2187 | //sprite(other), | ||
| 2188 | enemy(other) | ||
| 2189 | |||
| 2190 | { | ||
| 2191 | |||
| 2192 | //arrays | ||
| 2193 | |||
| 2194 | if(other.scrmem) | ||
| 2195 | { | ||
| 2196 | alloc_scriptmem(); | ||
| 2197 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 2198 | |||
| 2199 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 2200 | } | ||
| 2201 | else scrmem = NULL; | ||
| 2202 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 2203 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 2204 | |||
| 2205 | for ( int32_t q = 0; q < 255; q++ ) | ||
| 2206 | { | ||
| 2207 | nx[q] = other.nx[q]; | ||
| 2208 | ny[q] = other.ny[q]; | ||
| 2209 | nxoffset[q] = other.nxoffset[q]; | ||
| 2210 | nyoffset[q] = other.nyoffset[q]; | ||
| 2211 | } | ||
| 2212 | |||
| 2213 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 2214 | defense[i]=other.defense[i]; | ||
| 2215 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 2216 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 2217 | |||
| 2218 | if(new_script_uid) | ||
| 2219 | { | ||
| 2220 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 2221 | } | ||
| 2222 | if(clear_parent_script_UID) | ||
| 2223 | { | ||
| 2224 | parent_script_UID = 0; | ||
| 2225 | } | ||
| 2226 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 2227 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 2228 | |||
| 2229 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 2230 | { | ||
| 2231 | initD[q] = other.initD[q]; | ||
| 2232 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 2233 | } | ||
| 2234 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 2235 | { | ||
| 2236 | initA[q] = other.initA[q]; | ||
| 2237 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 2238 | } | ||
| 2239 | } | ||
| 2240 | |||
| 2241 | esPatraBS::esPatraBS(esPatraBS const & other, bool new_script_uid, bool clear_parent_script_UID): | ||
| 2242 | //Struct Element Type Purpose | ||
| 2243 | //sprite(other), | ||
| 2244 | enemy(other) | ||
| 2245 | |||
| 2246 | { | ||
| 2247 | |||
| 2248 | //arrays | ||
| 2249 | |||
| 2250 | if(other.scrmem) | ||
| 2251 | { | ||
| 2252 | alloc_scriptmem(); | ||
| 2253 | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | ||
| 2254 | |||
| 2255 | scrmem->scriptData = other.scrmem->scriptData; | ||
| 2256 | } | ||
| 2257 | else scrmem = NULL; | ||
| 2258 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 2259 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 2260 | |||
| 2261 | for ( int32_t q = 0; q < 255; q++ ) | ||
| 2262 | { | ||
| 2263 | nx[q] = other.nx[q]; | ||
| 2264 | ny[q] = other.ny[q]; | ||
| 2265 | nxoffset[q] = other.nxoffset[q]; | ||
| 2266 | nyoffset[q] = other.nyoffset[q]; | ||
| 2267 | } | ||
| 2268 | |||
| 2269 | for(int32_t i=0; i<edefLAST255; i++) | ||
| 2270 | defense[i]=other.defense[i]; | ||
| 2271 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | ||
| 2272 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | ||
| 2273 | |||
| 2274 | if(new_script_uid) | ||
| 2275 | { | ||
| 2276 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | ||
| 2277 | } | ||
| 2278 | if(clear_parent_script_UID) | ||
| 2279 | { | ||
| 2280 | parent_script_UID = 0; | ||
| 2281 | } | ||
| 2282 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | ||
| 2283 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | ||
| 2284 | |||
| 2285 | for ( int32_t q = 0; q < 8; q++ ) | ||
| 2286 | { | ||
| 2287 | initD[q] = other.initD[q]; | ||
| 2288 | weap_initiald[q] = other.weap_initiald[q]; | ||
| 2289 | } | ||
| 2290 | for ( int32_t q = 0; q < 2; q++ ) | ||
| 2291 | { | ||
| 2292 | initA[q] = other.initA[q]; | ||
| 2293 | weap_initiala[q] = other.weap_initiala[q]; | ||
| 2294 | } | ||
| 2295 | } | ||
| 2296 | |||
| 2297 | */ | ||
| 2298 | |||
| 2299 |
5/10✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48779 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 48779 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 48779 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 48779 times.
✗ Branch 9 not taken.
|
146337 | enemy::enemy(zfix X,zfix Y,int32_t Id,int32_t Clk) : sprite() |
| 2300 | 97558 | { | |
| 2301 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | x=X; |
| 2302 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | y=Y; |
| 2303 | 48779 | id=Id; | |
| 2304 | 48779 | clk=Clk; | |
| 2305 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | floor_y=y; |
| 2306 | 48779 | ceiling=false; | |
| 2307 | 48779 | fading = misc = clk2 = clk3 = stunclk = hclk = sclk = superman = 0; | |
| 2308 | 48779 | grumble = movestatus = posframe = timer = ox = oy = 0; | |
| 2309 |
4/8✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48779 times.
✓ Branch 4 taken 48779 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 48779 times.
✗ Branch 7 not taken.
|
48779 | yofs = (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) - ((isSideViewGravity()) ? 0 : 2); |
| 2310 | 48779 | did_armos=true; | |
| 2311 | 48779 | script_spawned=false; | |
| 2312 | |||
| 2313 | 48779 | d = guysbuf + (id & 0xFFF); | |
| 2314 | 48779 | hp = d->hp; | |
| 2315 | 48779 | starting_hp = hp; | |
| 2316 | // cs = d->cset; | ||
| 2317 | //d variables | ||
| 2318 | |||
| 2319 | 48779 | flags=d->flags; | |
| 2320 | 48779 | flags2=d->flags2; | |
| 2321 | 48779 | s_tile=d->s_tile; //secondary (additional) tile(s) | |
| 2322 | 48779 | family=d->family; | |
| 2323 | 48779 | dcset=d->cset; | |
| 2324 | 48779 | cs=dcset; | |
| 2325 |
3/4✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29494 times.
✓ Branch 3 taken 19285 times.
|
48779 | anim=get_bit(quest_rules,qr_NEWENEMYTILES)?d->e_anim:d->anim; |
| 2326 | 48779 | dp=d->dp; | |
| 2327 | 48779 | wdp=d->wdp; | |
| 2328 | 48779 | wpn=d->weapon; | |
| 2329 | 48779 | wpnsprite = d-> wpnsprite; //2.6 -Z | |
| 2330 | 48779 | rate=d->rate; | |
| 2331 | 48779 | hrate=d->hrate; | |
| 2332 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | dstep=d->step; |
| 2333 | 48779 | homing=d->homing; | |
| 2334 | 48779 | dmisc1=d->misc1; | |
| 2335 | 48779 | dmisc2=d->misc2; | |
| 2336 | 48779 | dmisc3=d->misc3; | |
| 2337 | 48779 | dmisc4=d->misc4; | |
| 2338 | 48779 | dmisc5=d->misc5; | |
| 2339 | 48779 | dmisc6=d->misc6; | |
| 2340 | 48779 | dmisc7=d->misc7; | |
| 2341 | 48779 | dmisc8=d->misc8; | |
| 2342 | 48779 | dmisc9=d->misc9; | |
| 2343 | 48779 | dmisc10=d->misc10; | |
| 2344 | 48779 | dmisc11=d->misc11; | |
| 2345 | 48779 | dmisc12=d->misc12; | |
| 2346 | 48779 | dmisc13=d->misc13; | |
| 2347 | 48779 | dmisc14=d->misc14; | |
| 2348 | 48779 | dmisc15=d->misc15; | |
| 2349 | 48779 | dmisc16=d->misc16; | |
| 2350 | 48779 | dmisc17=d->misc17; | |
| 2351 | 48779 | dmisc18=d->misc18; | |
| 2352 | 48779 | dmisc19=d->misc19; | |
| 2353 | 48779 | dmisc20=d->misc20; | |
| 2354 | 48779 | dmisc21=d->misc21; | |
| 2355 | 48779 | dmisc22=d->misc22; | |
| 2356 | 48779 | dmisc23=d->misc23; | |
| 2357 | 48779 | dmisc24=d->misc24; | |
| 2358 | 48779 | dmisc25=d->misc25; | |
| 2359 | 48779 | dmisc26=d->misc26; | |
| 2360 | 48779 | dmisc27=d->misc27; | |
| 2361 | 48779 | dmisc28=d->misc28; | |
| 2362 | 48779 | dmisc29=d->misc29; | |
| 2363 | 48779 | dmisc30=d->misc30; | |
| 2364 | 48779 | dmisc31=d->misc31; | |
| 2365 | 48779 | dmisc32=d->misc32; | |
| 2366 |
3/4✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48275 times.
✓ Branch 3 taken 504 times.
|
48779 | if (get_bit(quest_rules, qr_BROKEN_ATTRIBUTE_31_32)) |
| 2367 | { | ||
| 2368 | 48275 | dmisc31 = dmisc32; | |
| 2369 | 48275 | dmisc32 = 0; | |
| 2370 | 48275 | } | |
| 2371 | 48779 | spr_shadow=d->spr_shadow; | |
| 2372 | 48779 | spr_death=d->spr_death; | |
| 2373 | 48779 | spr_spawn=d->spr_spawn; | |
| 2374 | |||
| 2375 |
2/2✓ Branch 0 taken 1999939 times.
✓ Branch 1 taken 48779 times.
|
2048718 | for(int32_t i=0; i<edefLAST255; i++) |
| 2376 | 1999939 | defense[i]=d->defense[i]; | |
| 2377 | |||
| 2378 | 48779 | bgsfx=d->bgsfx; | |
| 2379 | 48779 | hitsfx=d->hitsfx; | |
| 2380 | 48779 | deadsfx=d->deadsfx; | |
| 2381 | 48779 | bosspal=d->bosspal; | |
| 2382 | 48779 | parent_script_UID = 0; | |
| 2383 | |||
| 2384 | 48779 | frozentile = d->frozentile; | |
| 2385 | |||
| 2386 | 48779 | frozencset = d->frozencset; | |
| 2387 | 48779 | frozenclock = 0; | |
| 2388 |
2/2✓ Branch 0 taken 487790 times.
✓ Branch 1 taken 48779 times.
|
536569 | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = d->frozenmisc[q]; |
| 2389 | |||
| 2390 |
2/2✓ Branch 0 taken 48779 times.
✓ Branch 1 taken 780464 times.
|
829243 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = 0; |
| 2391 | //firesfx = 0; //t.b.a -Z | ||
| 2392 | 48779 | isCore = true; //t.b.a | |
| 2393 | 48779 | parentCore = 0; //t.b.a | |
| 2394 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. |
| 2395 | |||
| 2396 | 48779 | firesfx = d->firesfx; | |
| 2397 |
2/2✓ Branch 0 taken 1560928 times.
✓ Branch 1 taken 48779 times.
|
1609707 | for ( int32_t q = 0; q < 32; q++ ) movement[q] = d->movement[q]; |
| 2398 |
2/2✓ Branch 0 taken 1560928 times.
✓ Branch 1 taken 48779 times.
|
1609707 | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = d->new_weapon[q]; |
| 2399 | |||
| 2400 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | script = (d->script >= 0) ? d->script : 0; //Dont assign invalid data. |
| 2401 | 48779 | waitdraw = 0; | |
| 2402 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | weaponscript = (d->weaponscript >= 0) ? d->weaponscript : 0; //Dont assign invalid data. |
| 2403 | |||
| 2404 |
2/2✓ Branch 0 taken 390232 times.
✓ Branch 1 taken 48779 times.
|
439011 | for ( int32_t q = 0; q < 8; q++ ) |
| 2405 | { | ||
| 2406 | 390232 | initD[q] = d->initD[q]; | |
| 2407 | //Z_scripterrlog("(enemy::enemy(zfix)): Loading weapon InitD[%d] to an enemy with a value of (%d)\n",q,d->weap_initiald[q]); | ||
| 2408 | 390232 | weap_initiald[q] = d->weap_initiald[q]; | |
| 2409 | //al_trace("Guys.cpp: Assigning guy.initD[%d]: %d\n",q, d->initD.initD[q]); | ||
| 2410 | //al_trace("Guys.cpp: Assigning guy.initD[%d] from d->initD[%d]: %d\n",q,q, d->initD[q]); | ||
| 2411 | //al_trace("Guys.cpp: guy.initD[%d] is: %d\n",q, initD[q]); | ||
| 2412 | 390232 | } | |
| 2413 |
2/2✓ Branch 0 taken 97558 times.
✓ Branch 1 taken 48779 times.
|
146337 | for ( int32_t q = 0; q < 2; q++ ) |
| 2414 | { | ||
| 2415 | 97558 | initA[q] = d->initA[q]; | |
| 2416 | 97558 | weap_initiala[q] = d->weap_initiala[q]; | |
| 2417 | 97558 | } | |
| 2418 | |||
| 2419 | 48779 | stickclk = 0; | |
| 2420 | 48779 | submerged = false; | |
| 2421 | 48779 | ffcactivated = 0; | |
| 2422 | 48779 | hitdir = -1; | |
| 2423 | 48779 | dialogue_str = 0; //set by spawn flags. | |
| 2424 | 48779 | editorflags = d->editorflags; //set by Enemy Editor | |
| 2425 | //Set the drawing flag for this sprite. | ||
| 2426 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | if ( (editorflags&ENEMY_FLAG12) ) { drawflags |= sprdrawflagALWAYSOLDDRAWS; } |
| 2427 | |||
| 2428 | |||
| 2429 |
2/2✓ Branch 0 taken 7492 times.
✓ Branch 1 taken 41287 times.
|
48779 | if(bosspal>-1) |
| 2430 | { | ||
| 2431 |
1/2✓ Branch 0 taken 7492 times.
✗ Branch 1 not taken.
|
7492 | loadpalset(csBOSS,pSprite(bosspal)); |
| 2432 | 7492 | } | |
| 2433 | |||
| 2434 |
2/2✓ Branch 0 taken 22051 times.
✓ Branch 1 taken 26728 times.
|
48779 | if(bgsfx>-1) |
| 2435 | { | ||
| 2436 |
1/2✓ Branch 0 taken 22051 times.
✗ Branch 1 not taken.
|
22051 | cont_sfx(bgsfx); |
| 2437 | 22051 | } | |
| 2438 | |||
| 2439 |
3/4✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29494 times.
✓ Branch 3 taken 19285 times.
|
48779 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 2440 | { | ||
| 2441 | 29494 | o_tile=d->e_tile; | |
| 2442 | 29494 | frate = d->e_frate; | |
| 2443 | 29494 | } | |
| 2444 | else | ||
| 2445 | { | ||
| 2446 | 19285 | o_tile=d->tile; | |
| 2447 | 19285 | frate = d->frate; | |
| 2448 | } | ||
| 2449 | |||
| 2450 | 48779 | tile=0; //init to 0 here, but set it later. | |
| 2451 | |||
| 2452 | 48779 | scripttile = -1; | |
| 2453 | 48779 | scriptflip = -1; | |
| 2454 | 48779 | do_animation = 1; | |
| 2455 | 48779 | immortal = false; | |
| 2456 | 48779 | noSlide = false; | |
| 2457 | 48779 | deathexstate = -1; | |
| 2458 | |||
| 2459 | 48779 | hashero=false; | |
| 2460 | |||
| 2461 | // If they forgot the invisibility flag, here's another failsafe: | ||
| 2462 |
4/4✓ Branch 0 taken 2631 times.
✓ Branch 1 taken 46148 times.
✓ Branch 2 taken 94 times.
✓ Branch 3 taken 2537 times.
|
48779 | if(o_tile==0 && family!=eeSPINTILE) |
| 2463 | 2537 | flags |= guy_invisible; | |
| 2464 | |||
| 2465 | // step = d->step/100.0; | ||
| 2466 | // To preserve the odd step values for Keese & Gleeok heads. -L | ||
| 2467 |
5/8✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48779 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5685 times.
✓ Branch 5 taken 43094 times.
✓ Branch 6 taken 5685 times.
✗ Branch 7 not taken.
|
48779 | if(dstep==62.0) dstep+=0.5; |
| 2468 |
5/8✓ Branch 0 taken 43094 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 43094 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 345 times.
✓ Branch 5 taken 42749 times.
✓ Branch 6 taken 345 times.
✗ Branch 7 not taken.
|
43094 | else if(dstep==89) dstep-=1/9; |
| 2469 | |||
| 2470 |
5/10✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48779 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 48779 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 48779 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 48779 times.
✗ Branch 9 not taken.
|
48779 | step = zslongToFix(dstep*100); |
| 2471 | |||
| 2472 | |||
| 2473 | 48779 | item_set = d->item_set; | |
| 2474 | 48779 | grumble = d->grumble; | |
| 2475 | |||
| 2476 |
2/2✓ Branch 0 taken 37975 times.
✓ Branch 1 taken 10804 times.
|
48779 | if(frate == 0) |
| 2477 | 10804 | frate = 256; | |
| 2478 | |||
| 2479 | 48779 | leader = itemguy = dying = scored = false; | |
| 2480 | 48779 | canfreeze = count_enemy = true; | |
| 2481 | 48779 | mainguy = !(flags & guy_doesntcount); | |
| 2482 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | dir = zc_oldrand()&3; |
| 2483 | |||
| 2484 | //2.6 Enemy Editor Hit and TIle Sizes | ||
| 2485 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48779 | if ( ((d->SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && d->txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 2486 | //al_trace("->txsz:%i\n", d->txsz); Verified that this is setting the value. -Z | ||
| 2487 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 2488 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48779 | if ( ((d->SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && d->tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 2489 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
48779 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && d->hxsz >= 0 ) hxsz = d->hxsz; |
| 2490 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
48779 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && d->hysz >= 0 ) hysz = d->hysz; |
| 2491 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
48779 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && d->hzsz >= 0 ) hzsz = d->hzsz; |
| 2492 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | if ( (d->SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 2493 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | if ( (d->SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 2494 | // if ( (d->SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = d->hzofs; | ||
| 2495 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
48779 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 2496 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
|
48779 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 2497 | { | ||
| 2498 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 2499 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 2500 | ✗ | } | |
| 2501 | |||
| 2502 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 48779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
48779 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 2503 | |||
| 2504 | 48779 | SIZEflags = d->SIZEflags; | |
| 2505 | |||
| 2506 |
8/10✓ Branch 0 taken 48691 times.
✓ Branch 1 taken 88 times.
✓ Branch 2 taken 88 times.
✓ Branch 3 taken 48691 times.
✓ Branch 4 taken 88 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 88 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 87 times.
|
48779 | if((wpn==ewBomb || wpn==ewSBomb) && family!=eeOTHER && family!=eeFIRE && (family!=eeWALK || dmisc2 != e2tBOMBCHU)) |
| 2507 | 1 | wpn = 0; | |
| 2508 | |||
| 2509 | //tile should never be 0 after init --Z (failsafe) | ||
| 2510 |
4/6✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48779 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 47710 times.
✓ Branch 5 taken 1069 times.
|
48779 | if (tile <= 0 && FFCore.getQuestHeaderInfo(vZelda) >= 0x255) {tile = o_tile;} |
| 2511 | |||
| 2512 | //Moveflags; for gravity and pit interaction | ||
| 2513 | 48779 | moveflags = d->moveflags; | |
| 2514 |
3/4✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41717 times.
✓ Branch 3 taken 7062 times.
|
48779 | if(!can_pitfall(false)) |
| 2515 | { | ||
| 2516 | //Some enemies must not interact with pits. Force their flags, for sanity's sake. | ||
| 2517 | 7062 | moveflags &= ~FLAG_CAN_PITFALL; | |
| 2518 | 7062 | moveflags &= ~FLAG_CAN_WATERDROWN; | |
| 2519 | 7062 | } | |
| 2520 | |||
| 2521 |
1/2✓ Branch 0 taken 48779 times.
✗ Branch 1 not taken.
|
48779 | shieldCanBlock = get_bit(quest_rules,qr_GOHMA_UNDAMAGED_BUG)?true:false; |
| 2522 | 48779 | } | |
| 2523 | |||
| 2524 | //base clone constructor | ||
| 2525 | |||
| 2526 | ✗ | enemy::enemy(enemy const & other, bool new_script_uid, bool clear_parent_script_UID): | |
| 2527 | //Struct Element Type Purpose | ||
| 2528 | ✗ | sprite(other), | |
| 2529 | //x(other.x), //int32_t | ||
| 2530 | //y(other.y), //int32_t | ||
| 2531 | //id(other.id), //int32_t | ||
| 2532 | //clk(other.clk), //int32_t | ||
| 2533 | ✗ | floor_y(other.floor_y), //int32_t | |
| 2534 | ✗ | fading(other.fading), //int32_t | |
| 2535 | //misc(other.misc), //int32_t | ||
| 2536 | ✗ | clk2(other.clk2), //int32_t | |
| 2537 | ✗ | clk3(other.clk3), //int32_t | |
| 2538 | ✗ | stunclk(other.stunclk), //int32_t | |
| 2539 | ✗ | hclk(other.hclk), //int32_t | |
| 2540 | ✗ | sclk(other.sclk), //int32_t | |
| 2541 | ✗ | superman(other.superman), //int32_t | |
| 2542 | //grumble(other.grumble), //int32_t | ||
| 2543 | ✗ | movestatus(other.movestatus), //int32_t | |
| 2544 | ✗ | posframe(other.posframe), //int32_t | |
| 2545 | ✗ | timer(other.timer), //int32_t | |
| 2546 | ✗ | ox(other.ox), //int32_t | |
| 2547 | ✗ | oy(other.oy), //int32_t | |
| 2548 | //yofs(other.yofs), //int32_t | ||
| 2549 | ✗ | did_armos(other.did_armos), //int32_t | |
| 2550 | ✗ | script_spawned(other.script_spawned), //int32_t | |
| 2551 | ✗ | d(other.d), //int32_t | |
| 2552 | ✗ | hp(other.hp), //int32_t | |
| 2553 | ✗ | starting_hp(other.starting_hp), //int32_t | |
| 2554 | //flags(other.flags), //int32_t | ||
| 2555 | |||
| 2556 | ✗ | flags2(other.flags2), //int32_t | |
| 2557 | ✗ | s_tile(other.s_tile), //int32_t | |
| 2558 | ✗ | family(other.family), //int32_t | |
| 2559 | ✗ | dcset(other.dcset), //int32_t | |
| 2560 | //cs(other.cs), //int32_t | ||
| 2561 | ✗ | anim(other.anim), //int32_t | |
| 2562 | ✗ | dp(other.dp), //int32_t | |
| 2563 | ✗ | wdp(other.wdp), //int32_t | |
| 2564 | ✗ | wpnsprite(other.wpnsprite), //int32_t | |
| 2565 | ✗ | rate(other.rate), //int32_t | |
| 2566 | ✗ | hrate(other.hrate), //int32_t | |
| 2567 | ✗ | dstep(other.dstep), //int32_t | |
| 2568 | |||
| 2569 | ✗ | homing(other.homing), //int32_t | |
| 2570 | ✗ | dmisc1(other.dmisc1), //int32_t | |
| 2571 | ✗ | dmisc2(other.dmisc2), //int32_t | |
| 2572 | ✗ | dmisc3(other.dmisc3), //int32_t | |
| 2573 | ✗ | dmisc4(other.dmisc4), //int32_t | |
| 2574 | ✗ | dmisc5(other.dmisc5), //int32_t | |
| 2575 | ✗ | dmisc6(other.dmisc6), //int32_t | |
| 2576 | ✗ | dmisc7(other.dmisc7), //int32_t | |
| 2577 | ✗ | dmisc8(other.dmisc8), //int32_t | |
| 2578 | ✗ | dmisc9(other.dmisc9), //int32_t | |
| 2579 | ✗ | dmisc10(other.dmisc10), //int32_t | |
| 2580 | ✗ | dmisc11(other.dmisc11), //int32_t | |
| 2581 | ✗ | dmisc12(other.dmisc12), //int32_t | |
| 2582 | ✗ | dmisc13(other.dmisc13), //int32_t | |
| 2583 | ✗ | dmisc14(other.dmisc14), //int32_t | |
| 2584 | ✗ | dmisc15(other.dmisc15), //int32_t | |
| 2585 | ✗ | dmisc16(other.dmisc16), //int32_t | |
| 2586 | ✗ | dmisc17(other.dmisc17), //int32_t | |
| 2587 | ✗ | dmisc18(other.dmisc18), //int32_t | |
| 2588 | ✗ | dmisc19(other.dmisc19), //int32_t | |
| 2589 | ✗ | dmisc20(other.dmisc20), //int32_t | |
| 2590 | ✗ | dmisc21(other.dmisc21), //int32_t | |
| 2591 | ✗ | dmisc22(other.dmisc22), //int32_t | |
| 2592 | ✗ | dmisc23(other.dmisc23), //int32_t | |
| 2593 | ✗ | dmisc24(other.dmisc24), //int32_t | |
| 2594 | ✗ | dmisc25(other.dmisc25), //int32_t | |
| 2595 | ✗ | dmisc26(other.dmisc26), //int32_t | |
| 2596 | ✗ | dmisc27(other.dmisc27), //int32_t | |
| 2597 | ✗ | dmisc28(other.dmisc28), //int32_t | |
| 2598 | ✗ | dmisc29(other.dmisc29), //int32_t | |
| 2599 | ✗ | dmisc30(other.dmisc30), //int32_t | |
| 2600 | ✗ | dmisc31(other.dmisc31), //int32_t | |
| 2601 | ✗ | dmisc32(other.dmisc32), //int32_t | |
| 2602 | ✗ | bgsfx(other.bgsfx), //int32_t | |
| 2603 | ✗ | hitsfx(other.hitsfx), //int32_t | |
| 2604 | ✗ | deadsfx(other.deadsfx), //int32_t | |
| 2605 | ✗ | bosspal(other.bosspal), //int32_t | |
| 2606 | ✗ | parent_script_UID(other.parent_script_UID), //int32_t | |
| 2607 | ✗ | frozentile(other.frozentile), //int32_t | |
| 2608 | ✗ | frozencset(other.frozencset), //int32_t | |
| 2609 | ✗ | frozenclock(other.frozenclock), //int32_t | |
| 2610 | ✗ | isCore(other.isCore), //int32_t | |
| 2611 | ✗ | parentCore(other.parentCore), //int32_t | |
| 2612 | ✗ | script_UID(other.script_UID), //int32_t | |
| 2613 | ✗ | firesfx(other.firesfx), //int32_t | |
| 2614 | //script(other.script), //int32_t | ||
| 2615 | //waitdraw(other.waitdraw), //int32_t | ||
| 2616 | ✗ | weaponscript(other.weaponscript), //int32_t | |
| 2617 | ✗ | stickclk(other.stickclk), //int32_t | |
| 2618 | ✗ | hitdir(other.hitdir), //int32_t | |
| 2619 | ✗ | submerged(other.submerged), //int32_t | |
| 2620 | ✗ | ffcactivated(other.ffcactivated), //word | |
| 2621 | |||
| 2622 | ✗ | dialogue_str(other.dialogue_str), //int32_t | |
| 2623 | ✗ | editorflags(other.editorflags), //int32_t | |
| 2624 | //drawflags(other.drawflags), //int32_t | ||
| 2625 | ✗ | o_tile(other.o_tile), //int32_t | |
| 2626 | ✗ | frate(other.frate), //int32_t | |
| 2627 | //tile(other.tile), //int32_t | ||
| 2628 | //scripttile(other.scripttile), //int32_t | ||
| 2629 | //scriptflip(other.scriptflip), //int32_t | ||
| 2630 | //do_animation(other.do_animation), //int32_t | ||
| 2631 | ✗ | immortal(other.immortal), //bool | |
| 2632 | ✗ | noSlide(other.noSlide), //bool | |
| 2633 | ✗ | deathexstate(other.deathexstate), //int32_t | |
| 2634 | ✗ | flags(other.flags), //int32_t | |
| 2635 | ✗ | step(other.step), //int32_t | |
| 2636 | |||
| 2637 | ✗ | item_set(other.item_set), //int32_t | |
| 2638 | ✗ | grumble(other.grumble), //int32_t | |
| 2639 | ✗ | leader(other.leader), //int32_t | |
| 2640 | ✗ | itemguy(other.itemguy), //int32_t | |
| 2641 | ✗ | dying(other.dying), //int32_t | |
| 2642 | ✗ | scored(other.scored), //int32_t | |
| 2643 | //canfreeze(other.canfreeze), //int32_t | ||
| 2644 | ✗ | count_enemy(other.count_enemy), //int32_t | |
| 2645 | ✗ | mainguy(other.mainguy), //int32_t | |
| 2646 | //dir(other.dir), //int32_t | ||
| 2647 | |||
| 2648 | //txsz(other.txsz), //int32_t | ||
| 2649 | //tysz(other.tysz), //int32_t | ||
| 2650 | //hxsz(other.hxsz), //int32_t | ||
| 2651 | //hysz(other.hysz), //int32_t | ||
| 2652 | //hzsz(other.hzsz), //int32_t | ||
| 2653 | //hxofs(other.hxofs), //int32_t | ||
| 2654 | //hxofs(other.hxofs), //int32_t | ||
| 2655 | //xofs(other.xofs), //int32_t | ||
| 2656 | //yofs(other.yofs), //int32_t | ||
| 2657 | //hzofs(other.hzofs), //int32_t | ||
| 2658 | //zofs(other.zofs), //int32_t | ||
| 2659 | |||
| 2660 | ✗ | wpn(other.wpn), //int32_t | |
| 2661 | ✗ | SIZEflags(other.SIZEflags), //int32_t | |
| 2662 | ✗ | hashero(other.hashero) | |
| 2663 | |||
| 2664 | ✗ | { | |
| 2665 | |||
| 2666 | //arrays | ||
| 2667 | |||
| 2668 | ✗ | if(other.scrmem) | |
| 2669 | { | ||
| 2670 | ✗ | alloc_scriptmem(); | |
| 2671 | ✗ | memcpy(scrmem->stack, other.scrmem->stack, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 2672 | |||
| 2673 | ✗ | scrmem->scriptData = other.scrmem->scriptData; | |
| 2674 | ✗ | } | |
| 2675 | ✗ | else scrmem = NULL; | |
| 2676 | //memset((refInfo)scriptData, 0xFFFF, sizeof(refInfo)); | ||
| 2677 | //memset((refInfo)scriptData, other.scriptData, sizeof(refInfo)); | ||
| 2678 | |||
| 2679 | ✗ | for(int32_t i=0; i<edefLAST255; i++) | |
| 2680 | ✗ | defense[i]=other.defense[i]; | |
| 2681 | ✗ | for ( int32_t q = 0; q < 10; q++ ) frozenmisc[q] = other.frozenmisc[q]; | |
| 2682 | ✗ | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) hitby[q] = other.hitby[q]; | |
| 2683 | |||
| 2684 | ✗ | if(new_script_uid) | |
| 2685 | { | ||
| 2686 | ✗ | script_UID = FFCore.GetScriptObjectUID(UID_TYPE_NPC); //This is used by child npcs. | |
| 2687 | ✗ | } | |
| 2688 | ✗ | if(clear_parent_script_UID) | |
| 2689 | { | ||
| 2690 | ✗ | parent_script_UID = 0; | |
| 2691 | ✗ | } | |
| 2692 | ✗ | for ( int32_t q = 0; q < 32; q++ ) movement[q] = other.movement[q]; | |
| 2693 | ✗ | for ( int32_t q = 0; q < 32; q++ ) new_weapon[q] = other.new_weapon[q]; | |
| 2694 | |||
| 2695 | ✗ | for ( int32_t q = 0; q < 8; q++ ) | |
| 2696 | { | ||
| 2697 | ✗ | initD[q] = other.initD[q]; | |
| 2698 | ✗ | weap_initiald[q] = other.weap_initiald[q]; | |
| 2699 | ✗ | } | |
| 2700 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 2701 | { | ||
| 2702 | ✗ | initA[q] = other.initA[q]; | |
| 2703 | ✗ | weap_initiala[q] = other.weap_initiala[q]; | |
| 2704 | ✗ | } | |
| 2705 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. | |
| 2706 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 2707 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 2708 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = tysz; if ( tysz > 1 ) extend = 3; } | |
| 2709 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = hxsz; | |
| 2710 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = hysz; | |
| 2711 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = hzsz; | |
| 2712 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = hxofs; | |
| 2713 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = hyofs; | |
| 2714 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 2715 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)xofs; | |
| 2716 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) | |
| 2717 | { | ||
| 2718 | ✗ | yofs = (int32_t)yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 2719 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 2720 | ✗ | } | |
| 2721 | |||
| 2722 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)zofs; | |
| 2723 | |||
| 2724 | |||
| 2725 | |||
| 2726 | |||
| 2727 | ✗ | } | |
| 2728 | |||
| 2729 | |||
| 2730 | 598 | int32_t enemy::getScriptUID() { return script_UID; } | |
| 2731 | ✗ | void enemy::setScriptUID(int32_t new_id) { script_UID = new_id; } | |
| 2732 | 48758 | enemy::~enemy() | |
| 2733 | 48758 | { | |
| 2734 |
2/4✓ Branch 0 taken 48758 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48758 times.
✗ Branch 3 not taken.
|
48758 | FFCore.deallocateAllArrays(SCRIPT_NPC, getUID()); |
| 2735 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 48754 times.
|
48758 | if(hashero) |
| 2736 | { | ||
| 2737 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | Hero.setEaten(0); |
| 2738 | 4 | hashero=false; | |
| 2739 | 4 | } | |
| 2740 | 48758 | } | |
| 2741 | |||
| 2742 | |||
| 2743 | ✗ | bool enemy::is_move_paused() | |
| 2744 | { | ||
| 2745 | ✗ | return (clk<0 || dying || stunclk || watch || ceiling || frozenclock || fallclk || drownclk); | |
| 2746 | } | ||
| 2747 | |||
| 2748 | 7765 | bool enemy::scr_walkflag(int32_t dx,int32_t dy,int32_t special, int32_t dir, int32_t input_x, int32_t input_y, bool kb) | |
| 2749 | { | ||
| 2750 | 7765 | int32_t yg = (special==spw_floater)?8:0; | |
| 2751 | 7765 | int32_t nb = get_bit(quest_rules, qr_NOBORDER) ? 16 : 0; | |
| 2752 | //Z_eventlog("Checking x,y %d,%d\n",dx,dy); | ||
| 2753 |
1/2✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
|
7765 | if(input_x == -1000) |
| 2754 | ✗ | input_x = dx; | |
| 2755 |
1/2✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
|
7765 | if(input_y == -1000) |
| 2756 | ✗ | input_y = dy; | |
| 2757 | |||
| 2758 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7765 times.
|
15530 | if(!(moveflags & FLAG_IGNORE_SCREENEDGE) |
| 2759 |
3/6✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7765 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7765 times.
|
7765 | && ((input_x<(16-nb)) || (input_y<zc_max(16-yg-nb,0)) |
| 2760 |
2/4✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7765 times.
✗ Branch 3 not taken.
|
7765 | || ((input_x+hxsz-1) >= (240+nb)) || ((input_y+hysz-1) >= (160+nb)))) |
| 2761 | ✗ | return true; | |
| 2762 | |||
| 2763 |
3/6✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7765 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7765 times.
✗ Branch 5 not taken.
|
7765 | if(!(moveflags & FLAG_CAN_PITWALK) && (!(moveflags & FLAG_CAN_PITFALL) || !kb)) //Don't walk into pits, unless being knocked back |
| 2764 | { | ||
| 2765 | ✗ | if(ispitfall(dx,dy)) | |
| 2766 | ✗ | return true; | |
| 2767 | ✗ | } | |
| 2768 | |||
| 2769 | 7765 | bool flying = false; | |
| 2770 | 7765 | bool cansolid = false; | |
| 2771 |
1/2✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
|
7765 | if(moveflags & FLAG_IGNORE_SOLIDITY) |
| 2772 | ✗ | cansolid = true; | |
| 2773 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7765 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7765 | switch(special) |
| 2774 | { | ||
| 2775 | case spw_clipbottomright: | ||
| 2776 | ✗ | if(dy>=128 || dx>=208) return true; | |
| 2777 | ✗ | break; | |
| 2778 | case spw_clipright: | ||
| 2779 | ✗ | break; //if(input_x>=208) return true; break; | |
| 2780 | |||
| 2781 | case spw_wizzrobe: // fall through | ||
| 2782 | case spw_floater: // Special case for fliers and wizzrobes - hack! | ||
| 2783 | { | ||
| 2784 | ✗ | if(isdungeon() && !(moveflags & FLAG_IGNORE_SCREENEDGE)) | |
| 2785 | { | ||
| 2786 | ✗ | if(dy < 32-yg || dy >= 144) return true; | |
| 2787 | ✗ | if(dx < 32 || dx >= 224) return true; | |
| 2788 | ✗ | } | |
| 2789 | ✗ | if(!(moveflags & FLAG_IGNORE_BLOCKFLAGS) && flyerblocked(dx, dy, special, kb)) | |
| 2790 | ✗ | return true; | |
| 2791 | ✗ | cansolid = true; | |
| 2792 | ✗ | flying = true; | |
| 2793 | } | ||
| 2794 | ✗ | } | |
| 2795 | |||
| 2796 | 7765 | dx &= ~7; | |
| 2797 | 7765 | dy &= ~7; | |
| 2798 | |||
| 2799 |
3/6✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7765 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7765 times.
✗ Branch 5 not taken.
|
7765 | if(!flying && !(moveflags & FLAG_IGNORE_BLOCKFLAGS) && groundblocked(dx,dy,kb)) return true; |
| 2800 | |||
| 2801 |
4/8✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7765 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7765 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7765 times.
|
7765 | if (dx < 0 || dx > 255 || dy < 0 || dy > 175) |
| 2802 | ✗ | return !(moveflags & FLAG_IGNORE_SCREENEDGE); | |
| 2803 | //_walkflag code | ||
| 2804 | mapscr *s1, *s2; | ||
| 2805 | 7765 | s1=(((*tmpscr).layermap[0]-1)>=0)?tmpscr2:NULL; | |
| 2806 | 7765 | s2=(((*tmpscr).layermap[1]-1)>=0)?tmpscr2+1:NULL; | |
| 2807 | |||
| 2808 | 7765 | int32_t cpos=(dx>>4)+(dy&0xF0); | |
| 2809 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 7765 times.
✓ Branch 2 taken 6784 times.
✓ Branch 3 taken 981 times.
|
7765 | int32_t ci = tmpscr->data[cpos], ci1 = (s1?s1:tmpscr)->data[cpos], ci2 = (s2?s2:tmpscr)->data[cpos]; |
| 2810 | 7765 | newcombo const& c = combobuf[ci]; | |
| 2811 | 7765 | newcombo const& c1 = combobuf[ci1]; | |
| 2812 | 7765 | newcombo const& c2 = combobuf[ci2]; | |
| 2813 | |||
| 2814 | 7765 | int32_t b=1; | |
| 2815 |
2/2✓ Branch 0 taken 4122 times.
✓ Branch 1 taken 3643 times.
|
7765 | if(dx&8) b<<=2; |
| 2816 |
2/2✓ Branch 0 taken 4667 times.
✓ Branch 1 taken 3098 times.
|
7765 | if(dy&8) b<<=1; |
| 2817 | |||
| 2818 | #define iwtr(cmb, x, y, shallow) \ | ||
| 2819 | (shallow \ | ||
| 2820 | ? iswaterex(cmb, currmap, currscr, -1, dx, dy, false, false, false, true, false) \ | ||
| 2821 | && !iswaterex(cmb, currmap, currscr, -1, dx, dy, false, false, false, false, false) \ | ||
| 2822 | : iswaterex(cmb, currmap, currscr, -1, dx, dy, false, false, false, false, false)) | ||
| 2823 | 7765 | bool wtr = iwtr(ci, dx, dy, false); | |
| 2824 |
1/2✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
|
7765 | bool shwtr = iwtr(ci, dx, dy, true); |
| 2825 | 7765 | bool pit = ispitfall(dx,dy); | |
| 2826 | |||
| 2827 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 7765 times.
✓ Branch 2 taken 7765 times.
✗ Branch 3 not taken.
|
7765 | bool canwtr = (moveflags & FLAG_CAN_WATERWALK) || ((moveflags & FLAG_CAN_WATERDROWN) && kb); |
| 2828 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 7765 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7765 times.
|
7765 | bool canpit = (moveflags & FLAG_CAN_PITWALK) || ((moveflags & FLAG_CAN_PITFALL) && kb); |
| 2829 | 7765 | bool needwtr = (moveflags & FLAG_ONLY_WATERWALK); | |
| 2830 | 7765 | bool needshwtr = (moveflags & FLAG_ONLY_SHALLOW_WATERWALK); | |
| 2831 | 7765 | bool needpit = (moveflags & FLAG_ONLY_PITWALK); | |
| 2832 | |||
| 2833 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7765 times.
|
7765 | if(!cansolid) |
| 2834 | { | ||
| 2835 | 7765 | int32_t cwalkflag = c.walk & 0xF; | |
| 2836 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7765 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7765 | if (c.type == cBRIDGE && get_bit(quest_rules, qr_OLD_BRIDGE_COMBOS)) cwalkflag = 0; |
| 2837 |
1/2✓ Branch 0 taken 7765 times.
✗ Branch 1 not taken.
|
7765 | if (s1) |
| 2838 | { | ||
| 2839 | ✗ | if (c1.type == cBRIDGE) | |
| 2840 | { | ||
| 2841 | ✗ | if (!get_bit(quest_rules, qr_OLD_BRIDGE_COMBOS)) | |
| 2842 | { | ||
| 2843 | ✗ | int efflag = (c1.walk & 0xF0)>>4; | |
| 2844 | ✗ | int newsolid = (c1.walk & 0xF); | |
| 2845 | ✗ | cwalkflag = ((newsolid | cwalkflag) & (~efflag)) | (newsolid & efflag); | |
| 2846 | ✗ | } | |
| 2847 | ✗ | else cwalkflag &= c1.walk; | |
| 2848 | ✗ | } | |
| 2849 | ✗ | else cwalkflag |= c1.walk & 0xF; | |
| 2850 | ✗ | } | |
| 2851 |
2/2✓ Branch 0 taken 981 times.
✓ Branch 1 taken 6784 times.
|
7765 | if (s2) |
| 2852 | { | ||
| 2853 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6784 times.
|
6784 | if (c2.type == cBRIDGE) |
| 2854 | { | ||
| 2855 | ✗ | if (!get_bit(quest_rules, qr_OLD_BRIDGE_COMBOS)) | |
| 2856 | { | ||
| 2857 | ✗ | int efflag = (c2.walk & 0xF0)>>4; | |
| 2858 | ✗ | int newsolid = (c2.walk & 0xF); | |
| 2859 | ✗ | cwalkflag = ((newsolid | cwalkflag) & (~efflag)) | (newsolid & efflag); | |
| 2860 | ✗ | } | |
| 2861 | ✗ | else cwalkflag &= c2.walk; | |
| 2862 | ✗ | } | |
| 2863 | 6784 | else cwalkflag |= c2.walk & 0xF; | |
| 2864 | 6784 | } | |
| 2865 |
2/2✓ Branch 0 taken 2533 times.
✓ Branch 1 taken 5232 times.
|
7765 | if(cwalkflag & b) |
| 2866 | 2533 | return true; | |
| 2867 | 5232 | } | |
| 2868 |
3/6✓ Branch 0 taken 5232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5232 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5232 times.
|
5232 | if(needwtr || needshwtr || needpit) |
| 2869 | { | ||
| 2870 | ✗ | bool ret = true; | |
| 2871 | ✗ | if (needwtr && wtr) ret = false; | |
| 2872 | ✗ | else if (needshwtr && shwtr) ret = false; | |
| 2873 | ✗ | else if (needpit && pit) ret = false; | |
| 2874 | ✗ | return ret; | |
| 2875 | } | ||
| 2876 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5232 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5232 | else if(wtr && !canwtr) |
| 2877 | ✗ | return true; | |
| 2878 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5232 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5232 | else if(pit && !canpit) |
| 2879 | ✗ | return true; | |
| 2880 | |||
| 2881 | 5232 | return false; | |
| 2882 | 7765 | } | |
| 2883 | |||
| 2884 | 4277 | bool enemy::scr_canmove(zfix dx, zfix dy, int32_t special, bool kb, bool ign_sv) | |
| 2885 | { | ||
| 2886 |
3/4✓ Branch 0 taken 3251 times.
✓ Branch 1 taken 1026 times.
✓ Branch 2 taken 3251 times.
✗ Branch 3 not taken.
|
4277 | if(!(dx || dy)) return true; |
| 2887 | 4277 | zfix bx = x+hxofs, by = y+hyofs; //left/top | |
| 2888 | 4277 | zfix rx = bx+hxsz-1, ry = by+hysz-1; //right/bottom | |
| 2889 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4277 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4277 | if(!ign_sv && dy < 0) //check gravity |
| 2890 | { | ||
| 2891 | ✗ | if((moveflags & FLAG_OBEYS_GRAV) && isSideViewGravity()) | |
| 2892 | ✗ | return false; | |
| 2893 | ✗ | } | |
| 2894 | |||
| 2895 |
2/4✓ Branch 0 taken 4277 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4277 times.
|
4277 | bool nosolid = !((moveflags & FLAG_IGNORE_SOLIDITY) || (special==spw_wizzrobe) || (special==spw_floater)); |
| 2896 | |||
| 2897 |
3/4✓ Branch 0 taken 1026 times.
✓ Branch 1 taken 3251 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1026 times.
|
4277 | if(dx && !dy) |
| 2898 | { | ||
| 2899 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 694 times.
|
1026 | if(dx < 0) |
| 2900 | { | ||
| 2901 |
2/4✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 332 times.
|
332 | special = (special==spw_clipbottomright||special==spw_clipright)?spw_none:special; |
| 2902 | 332 | int mx = (bx+dx).getFloor(); | |
| 2903 |
2/2✓ Branch 0 taken 664 times.
✓ Branch 1 taken 332 times.
|
996 | for(zfix ty = 0; by+ty < ry; ty += 8) |
| 2904 | { | ||
| 2905 |
1/2✓ Branch 0 taken 664 times.
✗ Branch 1 not taken.
|
664 | if(scr_walkflag(mx, by+ty, special, left, mx, by, kb)) |
| 2906 | ✗ | return false; | |
| 2907 | 664 | } | |
| 2908 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(scr_walkflag(mx, ry, special, left, mx, by, kb)) |
| 2909 | ✗ | return false; | |
| 2910 |
2/4✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 332 times.
✗ Branch 3 not taken.
|
332 | if(nosolid && collide_object(bx+dx,by,-dx,hysz,this)) |
| 2911 | ✗ | return false; | |
| 2912 | 332 | } | |
| 2913 | else | ||
| 2914 | { | ||
| 2915 | 694 | int mx = (rx+dx).getCeil(); | |
| 2916 | 694 | int lx = mx-hxsz+1; | |
| 2917 |
2/2✓ Branch 0 taken 1388 times.
✓ Branch 1 taken 694 times.
|
2082 | for(zfix ty = 0; by+ty < ry; ty += 8) |
| 2918 | { | ||
| 2919 |
1/2✓ Branch 0 taken 1388 times.
✗ Branch 1 not taken.
|
1388 | if(scr_walkflag(mx, by+ty, special, right, lx, by, kb)) |
| 2920 | ✗ | return false; | |
| 2921 | 1388 | } | |
| 2922 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 694 times.
|
694 | if(scr_walkflag(mx, ry, special, right, lx, by, kb)) |
| 2923 | ✗ | return false; | |
| 2924 |
2/4✓ Branch 0 taken 694 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 694 times.
✗ Branch 3 not taken.
|
694 | if(nosolid && collide_object(bx+hxsz,by,dx,hysz,this)) |
| 2925 | ✗ | return false; | |
| 2926 | } | ||
| 2927 | 1026 | } | |
| 2928 |
2/4✓ Branch 0 taken 3251 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3251 times.
|
3251 | else if(dy && !dx) |
| 2929 | { | ||
| 2930 |
2/2✓ Branch 0 taken 630 times.
✓ Branch 1 taken 2621 times.
|
3251 | if(dy < 0) |
| 2931 | { | ||
| 2932 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 630 times.
|
630 | special = (special==spw_clipbottomright)?spw_none:special; |
| 2933 | 630 | int my = (by+dy).getFloor(); | |
| 2934 |
2/2✓ Branch 0 taken 1260 times.
✓ Branch 1 taken 630 times.
|
1890 | for(zfix tx = 0; bx+tx < rx; tx += 8) |
| 2935 | { | ||
| 2936 |
1/2✓ Branch 0 taken 1260 times.
✗ Branch 1 not taken.
|
1260 | if(scr_walkflag(bx+tx, my, special, up, bx, my, kb)) |
| 2937 | ✗ | return false; | |
| 2938 | 1260 | } | |
| 2939 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 630 times.
|
630 | if(scr_walkflag(rx, my, special, up, bx, my, kb)) |
| 2940 | ✗ | return false; | |
| 2941 |
2/4✓ Branch 0 taken 630 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 630 times.
✗ Branch 3 not taken.
|
630 | if(nosolid && collide_object(bx,by+dy,hxsz,-dy,this)) |
| 2942 | ✗ | return false; | |
| 2943 | 630 | } | |
| 2944 | else | ||
| 2945 | { | ||
| 2946 | 2621 | int my = (ry+dy).getCeil(); | |
| 2947 | 2621 | int ly = my-hysz+1; | |
| 2948 |
2/2✓ Branch 0 taken 2709 times.
✓ Branch 1 taken 88 times.
|
2797 | for(zfix tx = 0; bx+tx < rx; tx += 8) |
| 2949 | { | ||
| 2950 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 2533 times.
|
2709 | if(scr_walkflag(bx+tx, my, special, down, bx, ly, kb)) |
| 2951 | 2533 | return false; | |
| 2952 | 176 | } | |
| 2953 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
88 | if(scr_walkflag(rx, my, special, down, bx, ly, kb)) |
| 2954 | ✗ | return false; | |
| 2955 |
2/4✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 88 times.
|
88 | if(nosolid && collide_object(bx,by+hysz,hxsz,dy,this)) |
| 2956 | ✗ | return false; | |
| 2957 | } | ||
| 2958 | 718 | } | |
| 2959 | else //! Untested, and currently unused. | ||
| 2960 | { | ||
| 2961 | ✗ | return scr_canmove(dx, 0, special, kb, ign_sv) && scr_canmove(dy, 0, special, kb, ign_sv); | |
| 2962 | } | ||
| 2963 | 1744 | return true; | |
| 2964 | 4277 | } | |
| 2965 | |||
| 2966 | ✗ | bool enemy::scr_canplace(zfix dx, zfix dy, int32_t special, bool kb) | |
| 2967 | { | ||
| 2968 | ✗ | zfix bx = dx+hxofs, by = dy+hyofs; //left/top | |
| 2969 | ✗ | zfix rx = bx+hxsz-1, ry = by+hysz-1; //right/bottom | |
| 2970 | |||
| 2971 | ✗ | bool nosolid = !((moveflags & FLAG_IGNORE_SOLIDITY) || (special==spw_wizzrobe) || (special==spw_floater)); | |
| 2972 | |||
| 2973 | ✗ | if(nosolid && collide_object(bx,by,hxsz,hysz,this)) | |
| 2974 | ✗ | return false; | |
| 2975 | ✗ | for(zfix ty = 0; by+ty < ry; ty += 8) | |
| 2976 | { | ||
| 2977 | ✗ | for(zfix tx = 0; bx+tx < rx; tx += 8) | |
| 2978 | { | ||
| 2979 | ✗ | if(scr_walkflag(bx+tx, by+ty, special, -1, -1000, -1000, kb)) | |
| 2980 | ✗ | return false; | |
| 2981 | ✗ | } | |
| 2982 | ✗ | if(scr_walkflag(rx, by+ty, special, -1, -1000, -1000, kb)) | |
| 2983 | ✗ | return false; | |
| 2984 | ✗ | } | |
| 2985 | ✗ | for(zfix tx = 0; bx+tx < rx; tx += 8) | |
| 2986 | { | ||
| 2987 | ✗ | if(scr_walkflag(bx+tx, ry, special, -1, -1000, -1000, kb)) | |
| 2988 | ✗ | return false; | |
| 2989 | ✗ | } | |
| 2990 | ✗ | if(scr_walkflag(rx, ry, special, -1, -1000, -1000, kb)) | |
| 2991 | ✗ | return false; | |
| 2992 | ✗ | return true; | |
| 2993 | ✗ | } | |
| 2994 | |||
| 2995 | ✗ | bool enemy::scr_canplace(zfix dx, zfix dy, int32_t special, bool kb, int32_t nwid, int32_t nhei) | |
| 2996 | { | ||
| 2997 | ✗ | auto oxsz = hxsz, oysz = hysz; | |
| 2998 | ✗ | if(nwid > -1) hxsz = nwid; | |
| 2999 | ✗ | if(nhei > -1) hysz = nhei; | |
| 3000 | ✗ | bool ret = scr_canplace(dx,dy,special,kb); | |
| 3001 | ✗ | hxsz = oxsz; hysz = oysz; | |
| 3002 | ✗ | return ret; | |
| 3003 | } | ||
| 3004 | |||
| 3005 | 1796 | bool enemy::movexy(zfix dx, zfix dy, int32_t special, bool kb, bool ign_sv, bool earlyret) | |
| 3006 | { | ||
| 3007 | 1796 | bool ret = true; | |
| 3008 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 1796 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1796 | if(!ign_sv && dy < 0 && (moveflags & FLAG_OBEYS_GRAV) && isSideViewGravity()) |
| 3009 | ✗ | dy = 0; | |
| 3010 | 1796 | const int scl = 2; | |
| 3011 |
4/4✓ Branch 0 taken 70 times.
✓ Branch 1 taken 1919 times.
✓ Branch 2 taken 193 times.
✓ Branch 3 taken 1796 times.
|
1989 | while(abs(dx) > scl || abs(dy) > scl) |
| 3012 | { | ||
| 3013 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 136 times.
|
193 | if(abs(dx) > abs(dy)) |
| 3014 | { | ||
| 3015 | 57 | int32_t tdx = dx.sign() * scl; | |
| 3016 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(movexy(tdx, 0, special, kb, ign_sv, earlyret)) |
| 3017 | 57 | dx -= tdx; | |
| 3018 | else | ||
| 3019 | { | ||
| 3020 | ✗ | if(earlyret) return false; | |
| 3021 | ✗ | dx = tdx; | |
| 3022 | ✗ | ret = false; | |
| 3023 | } | ||
| 3024 | 57 | } | |
| 3025 | else | ||
| 3026 | { | ||
| 3027 | 136 | int32_t tdy = dy.sign() * scl; | |
| 3028 |
2/2✓ Branch 0 taken 74 times.
✓ Branch 1 taken 62 times.
|
136 | if(movexy(0, tdy, special, kb, ign_sv, earlyret)) |
| 3029 | 74 | dy -= tdy; | |
| 3030 | else | ||
| 3031 | { | ||
| 3032 |
1/2✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
|
62 | if(earlyret) return false; |
| 3033 | 62 | dy = tdy; | |
| 3034 | 62 | ret = false; | |
| 3035 | } | ||
| 3036 | } | ||
| 3037 | } | ||
| 3038 | |||
| 3039 |
2/2✓ Branch 0 taken 770 times.
✓ Branch 1 taken 1026 times.
|
1796 | if(dx) |
| 3040 | { | ||
| 3041 |
1/2✓ Branch 0 taken 1026 times.
✗ Branch 1 not taken.
|
1026 | if(scr_canmove(dx, 0, special, kb, ign_sv)) |
| 3042 | 1026 | x += dx; | |
| 3043 | else | ||
| 3044 | { | ||
| 3045 | ✗ | if(earlyret) return false; | |
| 3046 | ✗ | ret = false; | |
| 3047 | ✗ | int xsign = dx.sign(); | |
| 3048 | ✗ | while(scr_canmove(xsign, 0, special, kb, ign_sv)) | |
| 3049 | { | ||
| 3050 | ✗ | x += xsign; | |
| 3051 | ✗ | dx -= xsign; | |
| 3052 | } | ||
| 3053 | ✗ | if(dx) | |
| 3054 | { | ||
| 3055 | ✗ | dx.doDecBound(0,-9999, 0,9999); | |
| 3056 | ✗ | dx = binary_search_zfix(dx.decsign(), dx, [&](zfix val, zfix& retval){ | |
| 3057 | ✗ | if(scr_canmove(val, 0, special, kb, ign_sv)) | |
| 3058 | { | ||
| 3059 | ✗ | retval = val; | |
| 3060 | ✗ | return BSEARCH_CONTINUE_AWAY0; | |
| 3061 | } | ||
| 3062 | ✗ | else return BSEARCH_CONTINUE_TOWARD0; | |
| 3063 | ✗ | }); | |
| 3064 | ✗ | x += dx; | |
| 3065 | ✗ | } | |
| 3066 | } | ||
| 3067 | 1026 | } | |
| 3068 |
2/2✓ Branch 0 taken 929 times.
✓ Branch 1 taken 867 times.
|
1796 | if(dy) |
| 3069 | { | ||
| 3070 |
2/2✓ Branch 0 taken 718 times.
✓ Branch 1 taken 149 times.
|
867 | if(scr_canmove(0, dy, special, kb, ign_sv)) |
| 3071 | 718 | y += dy; | |
| 3072 | else | ||
| 3073 | { | ||
| 3074 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 149 times.
|
149 | if(earlyret) return false; |
| 3075 | 149 | ret = false; | |
| 3076 | 149 | int ysign = dy.sign(); | |
| 3077 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 149 times.
|
149 | while(scr_canmove(0, ysign, special, kb, ign_sv)) |
| 3078 | { | ||
| 3079 | ✗ | y += ysign; | |
| 3080 | ✗ | dy -= ysign; | |
| 3081 | } | ||
| 3082 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 149 times.
|
149 | if(dy) |
| 3083 | { | ||
| 3084 | 149 | dy.doDecBound(0,-9999, 0,9999); | |
| 3085 |
3/6✓ Branch 0 taken 149 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 149 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 149 times.
✗ Branch 5 not taken.
|
2384 | dy = binary_search_zfix(dy.decsign(), dy, [&](zfix val, zfix& retval){ |
| 3086 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2235 times.
|
2235 | if(scr_canmove(0, val, special, kb, ign_sv)) |
| 3087 | { | ||
| 3088 | ✗ | retval = val; | |
| 3089 | ✗ | return BSEARCH_CONTINUE_AWAY0; | |
| 3090 | } | ||
| 3091 | 2235 | else return BSEARCH_CONTINUE_TOWARD0; | |
| 3092 | 2235 | }); | |
| 3093 | 149 | y += dy; | |
| 3094 | 149 | } | |
| 3095 | } | ||
| 3096 | 867 | } | |
| 3097 | 1796 | return ret; | |
| 3098 | 1796 | } | |
| 3099 | |||
| 3100 | ✗ | bool enemy::moveDir(int32_t dir, zfix px, int32_t special, bool kb, bool earlyret) | |
| 3101 | { | ||
| 3102 | ✗ | zfix diagrate = zslongToFix(7071); | |
| 3103 | ✗ | switch(NORMAL_DIR(dir)) | |
| 3104 | { | ||
| 3105 | case up: | ||
| 3106 | ✗ | return movexy(0, -px, special, kb, false, earlyret); | |
| 3107 | case down: | ||
| 3108 | ✗ | return movexy(0, px, special, kb, false, earlyret); | |
| 3109 | case left: | ||
| 3110 | ✗ | return movexy(-px, 0, special, kb, false, earlyret); | |
| 3111 | case right: | ||
| 3112 | ✗ | return movexy(px, 0, special, kb, false, earlyret); | |
| 3113 | case r_up: | ||
| 3114 | ✗ | return movexy(px*diagrate, -px*diagrate, special, kb, false, earlyret); | |
| 3115 | case r_down: | ||
| 3116 | ✗ | return movexy(px*diagrate, px*diagrate, special, kb, false, earlyret); | |
| 3117 | case l_up: | ||
| 3118 | ✗ | return movexy(-px*diagrate, -px*diagrate, special, kb, false, earlyret); | |
| 3119 | case l_down: | ||
| 3120 | ✗ | return movexy(-px*diagrate, px*diagrate, special, kb, false, earlyret); | |
| 3121 | } | ||
| 3122 | ✗ | return false; | |
| 3123 | ✗ | } | |
| 3124 | |||
| 3125 | ✗ | bool enemy::moveAtAngle(zfix degrees, zfix px, int32_t special, bool kb, bool earlyret) | |
| 3126 | { | ||
| 3127 | ✗ | double v = degrees.getFloat() * PI / 180.0; | |
| 3128 | ✗ | zfix dx = zc::math::Cos(v)*px, dy = zc::math::Sin(v)*px; | |
| 3129 | ✗ | return movexy(dx, dy, special, kb, false, earlyret); | |
| 3130 | } | ||
| 3131 | |||
| 3132 | ✗ | bool enemy::can_movexy(zfix dx, zfix dy, int32_t special, bool kb) | |
| 3133 | { | ||
| 3134 | ✗ | zfix tx = x, ty = y; | |
| 3135 | ✗ | bool ret = movexy(dx, dy, special, kb, false, true); | |
| 3136 | ✗ | x = tx; | |
| 3137 | ✗ | y = ty; | |
| 3138 | ✗ | return ret; | |
| 3139 | } | ||
| 3140 | ✗ | bool enemy::can_moveDir(int32_t dir, zfix px, int32_t special, bool kb) | |
| 3141 | { | ||
| 3142 | ✗ | zfix tx = x, ty = y; | |
| 3143 | ✗ | bool ret = moveDir(dir, px, special, kb, true); | |
| 3144 | ✗ | x = tx; | |
| 3145 | ✗ | y = ty; | |
| 3146 | ✗ | return ret; | |
| 3147 | } | ||
| 3148 | ✗ | bool enemy::can_moveAtAngle(zfix degrees, zfix px, int32_t special, bool kb) | |
| 3149 | { | ||
| 3150 | ✗ | zfix tx = x, ty = y; | |
| 3151 | ✗ | bool ret = moveAtAngle(degrees, px, special, kb, true); | |
| 3152 | ✗ | x = tx; | |
| 3153 | ✗ | y = ty; | |
| 3154 | ✗ | return ret; | |
| 3155 | } | ||
| 3156 | |||
| 3157 | // Handle pitfalls | ||
| 3158 | 19303846 | bool enemy::do_falling(int32_t index) | |
| 3159 | { | ||
| 3160 |
2/2✓ Branch 0 taken 19303704 times.
✓ Branch 1 taken 142 times.
|
19303846 | if(fallclk > 0) |
| 3161 | { | ||
| 3162 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
142 | if(fallclk == PITFALL_FALL_FRAMES && fallCombo) sfx(combobuf[fallCombo].attribytes[0], pan(x.getInt())); |
| 3163 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 4 times.
|
142 | if(!--fallclk) |
| 3164 | { | ||
| 3165 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(immortal) //Keep alive forever |
| 3166 | ✗ | ++fallclk; //force another frame of falling.... forever. | |
| 3167 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | else if(dying) //Give 1 frame for script revival |
| 3168 | { | ||
| 3169 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(flags&guy_neverret) |
| 3170 | ✗ | never_return(index); | |
| 3171 | |||
| 3172 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(leader) |
| 3173 | ✗ | kill_em_all(); | |
| 3174 | |||
| 3175 | //leave_item(); //Don't drop items in pits! | ||
| 3176 | 2 | stop_bgsfx(index); | |
| 3177 | 2 | return true; | |
| 3178 | } | ||
| 3179 | else | ||
| 3180 | { | ||
| 3181 | 2 | try_death(true); //Force death | |
| 3182 | 2 | ++fallclk; //force another frame of falling | |
| 3183 | } | ||
| 3184 | 2 | } | |
| 3185 | |||
| 3186 | 140 | wpndata& spr = wpnsbuf[QMisc.sprites[sprFALL]]; | |
| 3187 | 140 | cs = spr.csets & 0xF; | |
| 3188 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | int32_t fr = spr.frames ? spr.frames : 1; |
| 3189 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | int32_t spd = spr.speed ? spr.speed : 1; |
| 3190 | 140 | int32_t animclk = (PITFALL_FALL_FRAMES-fallclk); | |
| 3191 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 82 times.
|
140 | tile = spr.tile + zc_min(animclk / spd, fr-1); |
| 3192 | 140 | } | |
| 3193 | 19303844 | return false; | |
| 3194 | 19303846 | } | |
| 3195 | |||
| 3196 | // Handle drowning in water | ||
| 3197 | 19303704 | bool enemy::do_drowning(int32_t index) | |
| 3198 | { | ||
| 3199 |
1/2✓ Branch 0 taken 19303704 times.
✗ Branch 1 not taken.
|
19303704 | if(drownclk > 0) |
| 3200 | { | ||
| 3201 | //if(drownclk == WATER_DROWN_FRAMES && drownCombo) sfx(combobuf[drownCombo].attribytes[0], pan(x.getInt())); | ||
| 3202 | //!TODO: Drown SFX | ||
| 3203 | ✗ | if(!--drownclk) | |
| 3204 | { | ||
| 3205 | ✗ | if(immortal) //Keep alive forever | |
| 3206 | ✗ | ++drownclk; //force another frame of falling.... forever. | |
| 3207 | ✗ | else if(dying) //Give 1 frame for script revival | |
| 3208 | { | ||
| 3209 | ✗ | if(flags&guy_neverret) | |
| 3210 | ✗ | never_return(index); | |
| 3211 | |||
| 3212 | ✗ | if(leader) | |
| 3213 | ✗ | kill_em_all(); | |
| 3214 | |||
| 3215 | //leave_item(); //Don't drop items in pits! | ||
| 3216 | ✗ | stop_bgsfx(index); | |
| 3217 | ✗ | return true; | |
| 3218 | } | ||
| 3219 | else | ||
| 3220 | { | ||
| 3221 | ✗ | try_death(true); //Force death | |
| 3222 | ✗ | ++drownclk; //force another frame of falling | |
| 3223 | } | ||
| 3224 | ✗ | } | |
| 3225 | |||
| 3226 | ✗ | if (drownCombo && combobuf[drownCombo].usrflags&cflag1) | |
| 3227 | { | ||
| 3228 | ✗ | wpndata &spr = wpnsbuf[QMisc.sprites[sprLAVADROWN]]; | |
| 3229 | ✗ | cs = spr.csets & 0xF; | |
| 3230 | ✗ | int32_t fr = spr.frames ? spr.frames : 1; | |
| 3231 | ✗ | int32_t spd = spr.speed ? spr.speed : 1; | |
| 3232 | ✗ | int32_t animclk = (WATER_DROWN_FRAMES-drownclk); | |
| 3233 | ✗ | tile = spr.tile + zc_min((animclk % (spd*fr))/spd, fr-1); | |
| 3234 | ✗ | } | |
| 3235 | else | ||
| 3236 | { | ||
| 3237 | ✗ | wpndata &spr = wpnsbuf[QMisc.sprites[sprDROWN]]; | |
| 3238 | ✗ | cs = spr.csets & 0xF; | |
| 3239 | ✗ | int32_t fr = spr.frames ? spr.frames : 1; | |
| 3240 | ✗ | int32_t spd = spr.speed ? spr.speed : 1; | |
| 3241 | ✗ | int32_t animclk = (WATER_DROWN_FRAMES-drownclk); | |
| 3242 | ✗ | tile = spr.tile + zc_min((animclk % (spd*fr))/spd, fr-1); | |
| 3243 | } | ||
| 3244 | ✗ | } | |
| 3245 | 19303704 | return false; | |
| 3246 | 19303704 | } | |
| 3247 | |||
| 3248 | // Supplemental animation code that all derived classes should call | ||
| 3249 | // as a return value for animate(). | ||
| 3250 | // Handles the death animation and returns true when enemy is finished. | ||
| 3251 | 19664528 | bool enemy::Dead(int32_t index) | |
| 3252 | { | ||
| 3253 |
2/2✓ Branch 0 taken 1829 times.
✓ Branch 1 taken 19662699 times.
|
19664528 | if(immortal) |
| 3254 | { | ||
| 3255 | 1829 | dying = false; | |
| 3256 | 1829 | return false; | |
| 3257 | } | ||
| 3258 |
2/2✓ Branch 0 taken 394065 times.
✓ Branch 1 taken 19268634 times.
|
19662699 | if(dying) |
| 3259 | { | ||
| 3260 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 394064 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
394065 | if(deathexstate > -1 && deathexstate < 32) |
| 3261 | { | ||
| 3262 | 1 | setxmapflag(1<<deathexstate); | |
| 3263 | 1 | deathexstate = -1; | |
| 3264 | 1 | } | |
| 3265 | 394065 | --clk2; | |
| 3266 | |||
| 3267 |
4/4✓ Branch 0 taken 389370 times.
✓ Branch 1 taken 4695 times.
✓ Branch 2 taken 19765 times.
✓ Branch 3 taken 894 times.
|
394065 | if((get_bit(quest_rules,qr_HARDCODED_ENEMY_ANIMS) && clk2==12) |
| 3268 |
2/2✓ Branch 0 taken 20659 times.
✓ Branch 1 taken 368711 times.
|
389370 | && hp>-1000) // not killed by ringleader |
| 3269 | 19765 | death_sfx(); | |
| 3270 | |||
| 3271 |
2/2✓ Branch 0 taken 373188 times.
✓ Branch 1 taken 20877 times.
|
394065 | if(clk2==0) |
| 3272 | { | ||
| 3273 |
2/2✓ Branch 0 taken 20479 times.
✓ Branch 1 taken 398 times.
|
20877 | if(flags&guy_neverret) |
| 3274 | 398 | never_return(index); | |
| 3275 | |||
| 3276 |
2/2✓ Branch 0 taken 20824 times.
✓ Branch 1 taken 53 times.
|
20877 | if(leader) |
| 3277 | 53 | kill_em_all(); | |
| 3278 | |||
| 3279 | 20877 | leave_item(); | |
| 3280 | 20877 | } | |
| 3281 | |||
| 3282 | 394065 | stop_bgsfx(index); | |
| 3283 | 394065 | return (clk2==0); | |
| 3284 | } | ||
| 3285 | |||
| 3286 | 19268634 | return false; | |
| 3287 | 19664528 | } | |
| 3288 | |||
| 3289 | // Basic animation code that all derived classes should call. | ||
| 3290 | // The one with an index is the one that is called by | ||
| 3291 | // the guys sprite list; index is the enemy's index in the list. | ||
| 3292 | 20261744 | bool enemy::animate(int32_t index) | |
| 3293 | { | ||
| 3294 |
2/2✓ Branch 0 taken 1779401 times.
✓ Branch 1 taken 18482343 times.
|
20261744 | if(sclk <= 0) hitdir = -1; |
| 3295 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18573032 times.
|
20261744 | if(switch_hooked) |
| 3296 | { | ||
| 3297 | ✗ | if(get_bit(quest_rules, qr_SWITCHOBJ_RUN_SCRIPT)) | |
| 3298 | { | ||
| 3299 | //Run its script | ||
| 3300 | ✗ | if (run_script(MODE_NORMAL)==RUNSCRIPT_SELFDELETE) | |
| 3301 | { | ||
| 3302 | ✗ | return 0; //Avoid NULLPO if this object deleted itself | |
| 3303 | } | ||
| 3304 | ✗ | } | |
| 3305 | ✗ | return false; | |
| 3306 | } | ||
| 3307 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 18573030 times.
|
18573032 | if(do_falling(index)) return true; |
| 3308 |
2/2✓ Branch 0 taken 140 times.
✓ Branch 1 taken 18572890 times.
|
18573030 | else if(fallclk) |
| 3309 | { | ||
| 3310 | //clks | ||
| 3311 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 60 times.
|
140 | if(hclk>0) |
| 3312 | 60 | --hclk; | |
| 3313 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | if(stunclk>0) |
| 3314 | ✗ | --stunclk; | |
| 3315 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | if ( frozenclock > 0 ) |
| 3316 | ✗ | --frozenclock; | |
| 3317 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | if(hashero) |
| 3318 | { | ||
| 3319 | ✗ | Hero.setX(x); | |
| 3320 | ✗ | Hero.setY(y); | |
| 3321 | ✗ | Hero.fallCombo = fallCombo; | |
| 3322 | ✗ | Hero.fallclk = fallclk; | |
| 3323 | ✗ | hashero = false; //Let Hero go if falling | |
| 3324 | ✗ | } | |
| 3325 | 140 | run_script(MODE_NORMAL); | |
| 3326 | 140 | return false; | |
| 3327 | } | ||
| 3328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18572890 times.
|
18572890 | if(do_drowning(index)) return true; |
| 3329 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18572890 times.
|
18572890 | else if(drownclk) |
| 3330 | { | ||
| 3331 | //clks | ||
| 3332 | ✗ | if(hclk>0) | |
| 3333 | ✗ | --hclk; | |
| 3334 | ✗ | if(stunclk>0) | |
| 3335 | ✗ | --stunclk; | |
| 3336 | ✗ | if ( frozenclock > 0 ) | |
| 3337 | ✗ | --frozenclock; | |
| 3338 | ✗ | if(hashero) | |
| 3339 | { | ||
| 3340 | ✗ | Hero.setX(x); | |
| 3341 | ✗ | Hero.setY(y); | |
| 3342 | ✗ | Hero.drownclk = drownclk; | |
| 3343 | ✗ | hashero = false; //Let Hero go if falling | |
| 3344 | ✗ | } | |
| 3345 | ✗ | run_script(MODE_NORMAL); | |
| 3346 | ✗ | return false; | |
| 3347 | } | ||
| 3348 | 18572890 | int32_t nx = real_x(x); | |
| 3349 | 18572890 | int32_t ny = real_y(y); | |
| 3350 | |||
| 3351 |
4/4✓ Branch 0 taken 14190221 times.
✓ Branch 1 taken 4382669 times.
✓ Branch 2 taken 3599753 times.
✓ Branch 3 taken 15009766 times.
|
18572890 | if(ox!=nx || oy!=ny) |
| 3352 | { | ||
| 3353 | 7982422 | posframe=(posframe+1)%(get_bit(quest_rules,qr_NEWENEMYTILES)?4:2); | |
| 3354 | 7982422 | } | |
| 3355 | |||
| 3356 | 22992188 | ox = nx; | |
| 3357 | 22992188 | oy = ny; | |
| 3358 | |||
| 3359 | // Maybe they fell off the bottom in sideview, or were moved by a script. | ||
| 3360 | |||
| 3361 | //Check offscreen settings. I wrote it this way for clarity and to simplify testing. -Z | ||
| 3362 |
2/2✓ Branch 0 taken 3690313 times.
✓ Branch 1 taken 19301875 times.
|
22992188 | if ( immortal ) |
| 3363 | { | ||
| 3364 | //skip, as it can go out of bounds, from immortality | ||
| 3365 | 3690313 | } | |
| 3366 |
2/6✓ Branch 0 taken 19301875 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19301875 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19301875 | else if ( (moveflags & FLAG_IGNORE_SCREENEDGE) || (( (get_bit(quest_rules, qr_OUTOFBOUNDSENEMIES)) != (editorflags&ENEMY_FLAG11) ) && !NEWOUTOFBOUNDS(x,y,z+fakez)) ) |
| 3367 | { | ||
| 3368 | //skip, it can go out of bounds, from a quest rule, or from the enemy editor (but not both!) | ||
| 3369 | ✗ | } | |
| 3370 |
9/10✓ Branch 0 taken 18892182 times.
✓ Branch 1 taken 409693 times.
✓ Branch 2 taken 19301546 times.
✓ Branch 3 taken 329 times.
✓ Branch 4 taken 19296595 times.
✓ Branch 5 taken 4951 times.
✓ Branch 6 taken 19296595 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 36 times.
✓ Branch 9 taken 19296559 times.
|
19301875 | else if ( (OUTOFBOUNDS) ) |
| 3371 | { | ||
| 3372 | 5316 | hp=-1000; //kill it, as it is not immortal, and no quest bit or rule is enabled | |
| 3373 | 5316 | } | |
| 3374 | //fall down | ||
| 3375 |
6/6✓ Branch 0 taken 12582517 times.
✓ Branch 1 taken 10409671 times.
✓ Branch 2 taken 6562225 times.
✓ Branch 3 taken 16429963 times.
✓ Branch 4 taken 300716 times.
✓ Branch 5 taken 6261509 times.
|
22992188 | if((enemycanfall(id) || (moveflags & FLAG_OBEYS_GRAV) )&& fading != fade_flicker && clk>=0) |
| 3376 | { | ||
| 3377 |
2/2✓ Branch 0 taken 316274 times.
✓ Branch 1 taken 5945235 times.
|
6261509 | if(isSideViewGravity()) |
| 3378 | { | ||
| 3379 |
2/2✓ Branch 0 taken 303574 times.
✓ Branch 1 taken 12700 times.
|
316274 | if(get_bit(quest_rules,qr_OLD_SIDEVIEW_LANDING_CODE)) |
| 3380 | { | ||
| 3381 |
2/2✓ Branch 0 taken 176339 times.
✓ Branch 1 taken 127235 times.
|
303574 | if(!isOnSideviewPlatform()) |
| 3382 | { | ||
| 3383 | 127235 | bool willHitSVPlatform = false; | |
| 3384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 127235 times.
|
127235 | int32_t usewid = (SIZEflags&guyflagOVERRIDE_HIT_WIDTH)?hxsz:16; |
| 3385 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 127235 times.
|
127235 | int32_t usehei = (SIZEflags&guyflagOVERRIDE_HIT_HEIGHT)?hysz:16; |
| 3386 |
2/2✓ Branch 0 taken 127235 times.
✓ Branch 1 taken 127235 times.
|
254470 | for(int32_t nx = x+4; nx < x+usewid; nx+=16) |
| 3387 | { | ||
| 3388 |
5/8✓ Branch 0 taken 23361 times.
✓ Branch 1 taken 103874 times.
✓ Branch 2 taken 23361 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 23361 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 127235 times.
✗ Branch 7 not taken.
|
127235 | if(fall > 0 && !IGNORE_SIDEVIEW_PLATFORMS && checkSVLadderPlatform(x+4,y+(fall/100)+usehei-1) && (((int32_t(y)+(int32_t(fall)/100)+usehei-1)&0xF0)!=((int32_t(y)+usehei-1)&0xF0))) |
| 3389 | { | ||
| 3390 | ✗ | willHitSVPlatform = true; | |
| 3391 | ✗ | break; | |
| 3392 | } | ||
| 3393 | 127235 | } | |
| 3394 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 127235 times.
|
127235 | if(willHitSVPlatform) |
| 3395 | { | ||
| 3396 | ✗ | y+=fall/100; | |
| 3397 | //y-=int32_t(y)%16; //Fix to top of SV Ladder | ||
| 3398 | ✗ | do_fix(y, 16); //Fix to top of SV Ladder | |
| 3399 | ✗ | fall = 0; | |
| 3400 | ✗ | } | |
| 3401 | else | ||
| 3402 | { | ||
| 3403 | 127235 | y+=fall/100; | |
| 3404 |
2/2✓ Branch 0 taken 17808 times.
✓ Branch 1 taken 109427 times.
|
127235 | if(fall <= (int32_t)zinit.terminalv) |
| 3405 | 109427 | fall += (zinit.gravity2/100); | |
| 3406 | } | ||
| 3407 | 127235 | } | |
| 3408 | else | ||
| 3409 | { | ||
| 3410 |
2/2✓ Branch 0 taken 176072 times.
✓ Branch 1 taken 267 times.
|
176339 | if(fall!=0) // Only fix pos once |
| 3411 | { | ||
| 3412 | //y-=(int32_t)y%8; // Fix position | ||
| 3413 | 267 | do_fix(y, 8); //Fix position | |
| 3414 | 267 | } | |
| 3415 | |||
| 3416 | 176339 | fall = 0; | |
| 3417 | } | ||
| 3418 | 303574 | } | |
| 3419 | else | ||
| 3420 | { | ||
| 3421 |
2/2✓ Branch 0 taken 11361 times.
✓ Branch 1 taken 1339 times.
|
12700 | if(isOnSideviewPlatform()) |
| 3422 | 11361 | fall = 0; | |
| 3423 | else | ||
| 3424 | { | ||
| 3425 | 1339 | zfix fall_amnt = fall/100; | |
| 3426 | 1339 | bool hit = false; | |
| 3427 |
2/2✓ Branch 0 taken 1276 times.
✓ Branch 1 taken 1502 times.
|
2778 | while(fall_amnt >= 1) |
| 3428 | { | ||
| 3429 | 1502 | --fall_amnt; | |
| 3430 | 1502 | ++y; | |
| 3431 |
2/2✓ Branch 0 taken 1439 times.
✓ Branch 1 taken 63 times.
|
1502 | if(isOnSideviewPlatform()) |
| 3432 | { | ||
| 3433 | 63 | y = y.getInt(); | |
| 3434 | 63 | fall_amnt = 0; | |
| 3435 | 63 | hit = true; | |
| 3436 | 63 | break; | |
| 3437 | } | ||
| 3438 | } | ||
| 3439 |
2/2✓ Branch 0 taken 141 times.
✓ Branch 1 taken 1198 times.
|
1339 | if(fall_amnt > 0) |
| 3440 | 1198 | y += fall_amnt; | |
| 3441 |
1/2✓ Branch 0 taken 1339 times.
✗ Branch 1 not taken.
|
1339 | if(fall_amnt < 0) |
| 3442 | { | ||
| 3443 | ✗ | if(!movexy(0,fall_amnt,spw_none)) | |
| 3444 | ✗ | hit = true; | |
| 3445 | ✗ | } | |
| 3446 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 1276 times.
|
1339 | if(hit) |
| 3447 | 63 | fall = 0; | |
| 3448 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 1088 times.
|
1276 | else if(fall <= (int32_t)zinit.terminalv) |
| 3449 | 1088 | fall += (zinit.gravity2/100); | |
| 3450 | } | ||
| 3451 | } | ||
| 3452 | 316274 | } | |
| 3453 | else | ||
| 3454 | { | ||
| 3455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5945235 times.
|
5945235 | if (!(moveflags & FLAG_NO_FAKE_Z)) |
| 3456 | { | ||
| 3457 |
2/2✓ Branch 0 taken 3009463 times.
✓ Branch 1 taken 2935772 times.
|
5945235 | if(fakefall!=0) |
| 3458 | 2935772 | fakez-=(fakefall/100); | |
| 3459 | |||
| 3460 |
2/2✓ Branch 0 taken 2935772 times.
✓ Branch 1 taken 3009463 times.
|
5945235 | if(fakez<0) |
| 3461 | 2935772 | fakez = fakefall = 0; | |
| 3462 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3009463 times.
|
3009463 | else if(fakefall <= (int32_t)zinit.terminalv) |
| 3463 | 3009463 | fakefall += (zinit.gravity2/100); | |
| 3464 | |||
| 3465 |
5/6✓ Branch 0 taken 5945235 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3009463 times.
✓ Branch 3 taken 2935772 times.
✓ Branch 4 taken 2942942 times.
✓ Branch 5 taken 66521 times.
|
5945235 | if (fakez<=0 && fakefall > 0 && !get_bit(quest_rules, qr_FLUCTUATING_ENEMY_JUMP)) fakefall = 0; |
| 3466 | 5945235 | } | |
| 3467 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5945235 times.
|
5945235 | if (!(moveflags & FLAG_NO_REAL_Z)) |
| 3468 | { | ||
| 3469 |
2/2✓ Branch 0 taken 3057088 times.
✓ Branch 1 taken 2888147 times.
|
5945235 | if(fall!=0) |
| 3470 | 2888147 | z-=(fall/100); | |
| 3471 | |||
| 3472 |
2/2✓ Branch 0 taken 2882323 times.
✓ Branch 1 taken 3062912 times.
|
5945235 | if(z<0) |
| 3473 | 2882323 | z = fall = 0; | |
| 3474 |
2/2✓ Branch 0 taken 4644 times.
✓ Branch 1 taken 3058268 times.
|
3062912 | else if(fall <= (int32_t)zinit.terminalv) |
| 3475 | 3058268 | fall += (zinit.gravity2/100); | |
| 3476 | |||
| 3477 |
6/6✓ Branch 0 taken 5939314 times.
✓ Branch 1 taken 5921 times.
✓ Branch 2 taken 3056991 times.
✓ Branch 3 taken 2882323 times.
✓ Branch 4 taken 2990470 times.
✓ Branch 5 taken 66521 times.
|
5945235 | if (z<=0 && fall > 0 && !get_bit(quest_rules, qr_FLUCTUATING_ENEMY_JUMP)) fall = 0; |
| 3478 | 5945235 | } | |
| 3479 | |||
| 3480 | } | ||
| 3481 | 6261509 | } | |
| 3482 |
4/4✓ Branch 0 taken 18894011 times.
✓ Branch 1 taken 4098177 times.
✓ Branch 2 taken 9988816 times.
✓ Branch 3 taken 16572011 times.
|
22992188 | if(!isSideViewGravity() && (moveflags & FLAG_CAN_PITFALL)) |
| 3483 | { | ||
| 3484 |
8/10✓ Branch 0 taken 5531926 times.
✓ Branch 1 taken 11040085 times.
✓ Branch 2 taken 5524941 times.
✓ Branch 3 taken 6985 times.
✓ Branch 4 taken 5524941 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5531926 times.
✓ Branch 8 taken 5524941 times.
✓ Branch 9 taken 5524941 times.
|
16572011 | if(can_pitfall() && ((z <= 0 && fakez <= 0 && !isflier(id)) || (isflier(id) && (stunclk))) && !superman) |
| 3485 | { | ||
| 3486 | 5524941 | fallCombo = check_pits(); | |
| 3487 | 5524941 | } | |
| 3488 | 27621893 | } | |
| 3489 |
3/4✓ Branch 0 taken 18894011 times.
✓ Branch 1 taken 409693 times.
✓ Branch 2 taken 18894011 times.
✗ Branch 3 not taken.
|
19628716 | if(!isSideViewGravity() && (moveflags & FLAG_CAN_WATERDROWN)) |
| 3490 | { | ||
| 3491 | ✗ | if(can_pitfall() && ((z <= 0 && fakez <= 0 && !isflier(id)) || (isflier(id) && (stunclk))) && !superman) | |
| 3492 | { | ||
| 3493 | ✗ | drownCombo = check_water(); | |
| 3494 | ✗ | } | |
| 3495 | ✗ | } | |
| 3496 | |||
| 3497 | 19303704 | runKnockback(); //scripted knockback handling | |
| 3498 | |||
| 3499 | // clk is incremented here | ||
| 3500 |
2/2✓ Branch 0 taken 18271333 times.
✓ Branch 1 taken 1032371 times.
|
19303704 | if(++clk >= frate) |
| 3501 | 1032371 | clk=0; | |
| 3502 | |||
| 3503 | // hit and death handling | ||
| 3504 |
2/2✓ Branch 0 taken 18656194 times.
✓ Branch 1 taken 647510 times.
|
19303704 | if(hclk>0) |
| 3505 | 647510 | --hclk; | |
| 3506 | |||
| 3507 |
2/2✓ Branch 0 taken 18923536 times.
✓ Branch 1 taken 380168 times.
|
19303704 | if(stunclk>0) |
| 3508 | 380168 | --stunclk; | |
| 3509 |
1/2✓ Branch 0 taken 19303704 times.
✗ Branch 1 not taken.
|
19303704 | if ( frozenclock > 0 ) |
| 3510 | ✗ | --frozenclock; | |
| 3511 | |||
| 3512 |
5/6✓ Branch 0 taken 7002 times.
✓ Branch 1 taken 19296702 times.
✓ Branch 2 taken 55 times.
✓ Branch 3 taken 6947 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 55 times.
|
19303704 | if(ceiling && z <= 0 && fakez <= 0) |
| 3513 | 55 | ceiling = false; | |
| 3514 | |||
| 3515 | 19303704 | try_death(); | |
| 3516 | |||
| 3517 | 19303704 | scored=false; | |
| 3518 | |||
| 3519 | 19303704 | ++c_clk; | |
| 3520 | |||
| 3521 | //Run its script | ||
| 3522 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19303704 times.
|
19303704 | if (run_script(MODE_NORMAL)==RUNSCRIPT_SELFDELETE) |
| 3523 | { | ||
| 3524 | ✗ | return 0; //Avoid NULLPO if this object deleted itself | |
| 3525 | } | ||
| 3526 | |||
| 3527 | // returns true when enemy is defeated | ||
| 3528 | 19303704 | return Dead(index); | |
| 3529 | 19303846 | } | |
| 3530 | |||
| 3531 | 19701387 | bool enemy::setSolid(bool set) | |
| 3532 | { | ||
| 3533 |
1/2✓ Branch 0 taken 19701387 times.
✗ Branch 1 not taken.
|
19701387 | bool actual = set && !isSubmerged(); |
| 3534 | 19701387 | bool ret = solid_object::setSolid(actual); | |
| 3535 | 19701387 | solid = set; | |
| 3536 | 19701387 | return ret; | |
| 3537 | } | ||
| 3538 | ✗ | void enemy::doContactDamage(int32_t hdir) | |
| 3539 | { | ||
| 3540 | ✗ | Hero.hithero(guys.find(this), hdir); | |
| 3541 | ✗ | } | |
| 3542 | |||
| 3543 | 42798 | void enemy::solid_push(solid_object *obj) | |
| 3544 | { | ||
| 3545 |
1/2✓ Branch 0 taken 42798 times.
✗ Branch 1 not taken.
|
42798 | if(obj == this) return; //can't push self |
| 3546 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42798 times.
|
42798 | if(moveflags&FLAG_NOT_PUSHABLE) return; //not pushable |
| 3547 | 42798 | zfix dx, dy; | |
| 3548 | 42798 | int32_t hdir = -1; | |
| 3549 | 42798 | solid_push_int(obj,dx,dy,hdir); | |
| 3550 | |||
| 3551 |
4/4✓ Branch 0 taken 41829 times.
✓ Branch 1 taken 969 times.
✓ Branch 2 taken 41195 times.
✓ Branch 3 taken 634 times.
|
42798 | if(!dx && !dy) return; |
| 3552 | |||
| 3553 | 1603 | bool t = obj->getTempNonsolid(); | |
| 3554 | 1603 | obj->setTempNonsolid(true); | |
| 3555 | |||
| 3556 | 1603 | int32_t ydir = dy > 0 ? down : up; | |
| 3557 | 1603 | int32_t xdir = dx > 0 ? right : left; | |
| 3558 | |||
| 3559 | 1603 | auto special = isflier(id) ? spw_floater : spw_none; | |
| 3560 |
2/2✓ Branch 0 taken 1516 times.
✓ Branch 1 taken 87 times.
|
1603 | if(!movexy(dx,dy,special,true,true)) |
| 3561 | { | ||
| 3562 | //Crushed? | ||
| 3563 | 87 | } | |
| 3564 | |||
| 3565 | 1603 | obj->setTempNonsolid(t); | |
| 3566 | 42798 | } | |
| 3567 | 42798 | bool enemy::is_unpushable() const | |
| 3568 | { | ||
| 3569 | 42798 | return isSubmerged(); | |
| 3570 | } | ||
| 3571 | 42798 | bool enemy::sideview_mode() const | |
| 3572 | { | ||
| 3573 |
3/4✓ Branch 0 taken 13600 times.
✓ Branch 1 taken 29198 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13600 times.
|
42798 | return isSideViewGravity() && (moveflags&FLAG_OBEYS_GRAV) && !(moveflags&FLAG_NOT_PUSHABLE); |
| 3574 | } | ||
| 3575 | |||
| 3576 | 2447 | bool enemy::m_walkflag_old(int32_t dx,int32_t dy,int32_t special, int32_t x, int32_t y) | |
| 3577 | { | ||
| 3578 | 2447 | int32_t yg = (special==spw_floater)?8:0; | |
| 3579 | 2447 | int32_t nb = get_bit(quest_rules, qr_NOBORDER) ? 16 : 0; | |
| 3580 | |||
| 3581 |
8/10✓ Branch 0 taken 1858 times.
✓ Branch 1 taken 589 times.
✓ Branch 2 taken 533 times.
✓ Branch 3 taken 56 times.
✓ Branch 4 taken 589 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 589 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1860 times.
✓ Branch 9 taken 2449 times.
|
2447 | if(dx<16-nb || dy<zc_max(16-yg-nb,0) || dx>=240+nb || dy>=160+nb) |
| 3582 | 3718 | return true; | |
| 3583 | |||
| 3584 | 2449 | bool isInDungeon = isdungeon(); | |
| 3585 |
3/4✓ Branch 0 taken 115 times.
✓ Branch 1 taken 2334 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 115 times.
|
2449 | if(isInDungeon || special==spw_wizzrobe) |
| 3586 | { | ||
| 3587 |
7/8✓ Branch 0 taken 471 times.
✓ Branch 1 taken 1863 times.
✓ Branch 2 taken 466 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 472 times.
✓ Branch 5 taken 1396 times.
✓ Branch 6 taken 472 times.
✗ Branch 7 not taken.
|
2334 | if((x>=32 && dy<32-yg) || (y>-1000 && y<=144 && dy>=144)) |
| 3588 | 938 | return true; | |
| 3589 | |||
| 3590 |
7/8✓ Branch 0 taken 465 times.
✓ Branch 1 taken 931 times.
✓ Branch 2 taken 466 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 466 times.
✓ Branch 5 taken 466 times.
✓ Branch 6 taken 466 times.
✗ Branch 7 not taken.
|
1396 | if((x>=32 && dx<32) || (x>-1000 && x<224 && dx>=224)) |
| 3591 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
932 | if(special!=spw_door) // walk in door way |
| 3592 | ✗ | return true; | |
| 3593 | 466 | } | |
| 3594 | |||
| 3595 |
3/4✓ Branch 0 taken 39 times.
✓ Branch 1 taken 542 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
|
581 | if(!(moveflags & FLAG_CAN_PITWALK) && !(moveflags & FLAG_CAN_PITFALL)) //Don't walk into pits (knockback doesn't call this func) |
| 3596 | { | ||
| 3597 |
2/4✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
|
78 | if(ispitfall(dx,dy) || ispitfall(dx+8,dy) |
| 3598 |
2/4✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
✗ Branch 3 not taken.
|
39 | || ispitfall(dx,dy+8) || ispitfall(dx+8,dy+8)) |
| 3599 | ✗ | return true; | |
| 3600 | 39 | } | |
| 3601 | |||
| 3602 |
1/4✓ Branch 0 taken 581 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
581 | switch(special) |
| 3603 | { | ||
| 3604 | case spw_clipbottomright: | ||
| 3605 | ✗ | if(dy>=128 || dx>=208) return true; | |
| 3606 | ✗ | break; | |
| 3607 | case spw_clipright: | ||
| 3608 | ✗ | break; //if(x>=208) return true; break; | |
| 3609 | |||
| 3610 | case spw_wizzrobe: // fall through | ||
| 3611 | case spw_floater: // Special case for fliers and wizzrobes - hack! | ||
| 3612 | { | ||
| 3613 |
2/2✓ Branch 0 taken 115 times.
✓ Branch 1 taken 466 times.
|
581 | if(isInDungeon) |
| 3614 | { | ||
| 3615 |
2/4✓ Branch 0 taken 466 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 466 times.
|
466 | if(dy < 32-yg || dy >= 144) return true; |
| 3616 |
2/4✓ Branch 0 taken 466 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 466 times.
|
466 | if(dx < 32 || dx >= 224) return true; |
| 3617 | 466 | } | |
| 3618 | 581 | return false; | |
| 3619 | } | ||
| 3620 | } | ||
| 3621 | |||
| 3622 | ✗ | dx&=(special==spw_halfstep)?(~7):(~15); | |
| 3623 | ✗ | dy&=(special==spw_halfstep || isSideViewGravity())?(~7):(~15); | |
| 3624 | |||
| 3625 | ✗ | if(special==spw_water) | |
| 3626 | ✗ | return (water_walkflag(dx,dy+8,1) || water_walkflag(dx+8,dy+8,1)); | |
| 3627 | |||
| 3628 | ✗ | return _walkflag(dx,dy+8,1) || _walkflag(dx+8,dy+8,1) || | |
| 3629 | ✗ | groundblocked(dx,dy+8) || groundblocked(dx+8,dy+8); | |
| 3630 | 589 | } | |
| 3631 | |||
| 3632 | 5149 | bool enemy::m_walkflag_simple(int32_t dx,int32_t dy) | |
| 3633 | { | ||
| 3634 | 5149 | bool kb = false; | |
| 3635 | 5149 | int32_t nb = get_bit(quest_rules, qr_NOBORDER) ? 16 : 0; | |
| 3636 | |||
| 3637 |
6/10✗ Branch 0 not taken.
✓ Branch 1 taken 5149 times.
✓ Branch 2 taken 5041 times.
✓ Branch 3 taken 108 times.
✓ Branch 4 taken 5149 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5149 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 5149 times.
|
5149 | if(dx<16-nb || dy<zc_max(16-nb,0) || dx>=240+nb || dy>=160+nb) |
| 3638 | ✗ | return true; | |
| 3639 | |||
| 3640 |
2/2✓ Branch 0 taken 4434 times.
✓ Branch 1 taken 715 times.
|
5149 | if(isdungeon()) |
| 3641 | { | ||
| 3642 |
2/4✓ Branch 0 taken 715 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 715 times.
|
715 | if((dy<32) || (dy>=144)) |
| 3643 | ✗ | return true; | |
| 3644 | |||
| 3645 |
2/4✓ Branch 0 taken 715 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 715 times.
|
715 | if((dx<32) || (dx>=224)) |
| 3646 | ✗ | return true; | |
| 3647 | 715 | } | |
| 3648 | |||
| 3649 |
2/4✓ Branch 0 taken 5149 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5149 times.
|
5149 | if(!(moveflags & FLAG_CAN_PITWALK) && (!(moveflags & FLAG_CAN_PITFALL))) //Don't walk into pits, unless being knocked back |
| 3650 | { | ||
| 3651 |
2/4✓ Branch 0 taken 5149 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5149 times.
|
10298 | if(ispitfall(dx,dy) || ispitfall(dx+8,dy) |
| 3652 |
2/4✓ Branch 0 taken 5149 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5149 times.
✗ Branch 3 not taken.
|
5149 | || ispitfall(dx,dy+8) || ispitfall(dx+8,dy+8)) |
| 3653 | ✗ | return true; | |
| 3654 | 5149 | } | |
| 3655 | |||
| 3656 |
1/2✓ Branch 0 taken 5149 times.
✗ Branch 1 not taken.
|
5149 | if(get_bit(quest_rules,qr_ENEMY_BROKEN_TOP_HALF_SOLIDITY)) |
| 3657 | { | ||
| 3658 |
3/4✓ Branch 0 taken 1489 times.
✓ Branch 1 taken 3660 times.
✓ Branch 2 taken 1489 times.
✗ Branch 3 not taken.
|
6638 | return _walkflag(dx,dy+8,1) || _walkflag(dx+8,dy+8,1) || |
| 3659 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1489 times.
|
1489 | groundblocked(dx,dy+8,kb) || groundblocked(dx+8,dy+8,kb); |
| 3660 | } | ||
| 3661 | else | ||
| 3662 | { | ||
| 3663 | ✗ | return _walkflag(dx,dy,1) || _walkflag(dx+8,dy,1) || | |
| 3664 | ✗ | _walkflag(dx,dy+8,1) || _walkflag(dx+8,dy+8,1) || | |
| 3665 | ✗ | groundblocked(dx,dy,kb) || groundblocked(dx+8,dy,kb) || | |
| 3666 | ✗ | groundblocked(dx,dy+8,kb) || groundblocked(dx+8,dy+8,kb); | |
| 3667 | } | ||
| 3668 | 5149 | } | |
| 3669 | |||
| 3670 | 18583809 | bool enemy::m_walkflag(int32_t dx,int32_t dy,int32_t special, int32_t dir, int32_t input_x, int32_t input_y, bool kb) | |
| 3671 | { | ||
| 3672 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18583809 times.
|
18583809 | if(moveflags & FLAG_USE_NEW_MOVEMENT) |
| 3673 | ✗ | return scr_walkflag(dx,dy,special,dir,input_x,input_y,kb); | |
| 3674 | 18583809 | int32_t yg = (special==spw_floater)?8:0; | |
| 3675 | 18583809 | int32_t nb = get_bit(quest_rules, qr_NOBORDER) ? 16 : 0; | |
| 3676 |
2/2✓ Branch 0 taken 1808228 times.
✓ Branch 1 taken 16775581 times.
|
18583809 | switch(dir) |
| 3677 | { | ||
| 3678 | case l_down: | ||
| 3679 | case r_down: | ||
| 3680 | case down: | ||
| 3681 | case 11: //r_down | ||
| 3682 | case 12: //down | ||
| 3683 | case 13: //l_down | ||
| 3684 | { | ||
| 3685 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1808228 times.
|
1808228 | if ( ((unsigned)(id&0xFFF)) < MAXGUYS ) |
| 3686 | { | ||
| 3687 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1808228 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1808228 | if ( SIZEflags&guyflagOVERRIDE_HIT_HEIGHT && !isflier(id) ) |
| 3688 | { | ||
| 3689 | //Small enemies are treated as 16x16, for the purposes of m_walkflag! | ||
| 3690 | ✗ | dy += zc_max(hysz-16,0); | |
| 3691 | ✗ | } | |
| 3692 | 1808228 | } | |
| 3693 | 1808228 | break; | |
| 3694 | } | ||
| 3695 | } | ||
| 3696 |
2/2✓ Branch 0 taken 1820189 times.
✓ Branch 1 taken 16763620 times.
|
18583809 | switch(dir) |
| 3697 | { | ||
| 3698 | case r_up: | ||
| 3699 | case r_down: | ||
| 3700 | case right: | ||
| 3701 | case 9: //r_up | ||
| 3702 | case 10: //right | ||
| 3703 | case 11: //r_down | ||
| 3704 | { | ||
| 3705 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1820189 times.
|
1820189 | if ( ((unsigned)(id&0xFFF)) < MAXGUYS ) |
| 3706 | { | ||
| 3707 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1820189 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1820189 | if ( SIZEflags&guyflagOVERRIDE_HIT_WIDTH && !isflier(id) ) |
| 3708 | { | ||
| 3709 | //Small enemies are treated as 16x16, for the purposes of m_walkflag! | ||
| 3710 | ✗ | dx += zc_max(hxsz-16,0); | |
| 3711 | ✗ | } | |
| 3712 | 1820189 | } | |
| 3713 | 1820189 | break; | |
| 3714 | } | ||
| 3715 | } | ||
| 3716 | //Z_eventlog("Checking x,y %d,%d\n",dx,dy); | ||
| 3717 | |||
| 3718 |
10/10✓ Branch 0 taken 13695577 times.
✓ Branch 1 taken 4888232 times.
✓ Branch 2 taken 1105531 times.
✓ Branch 3 taken 3782701 times.
✓ Branch 4 taken 4878164 times.
✓ Branch 5 taken 10068 times.
✓ Branch 6 taken 4866673 times.
✓ Branch 7 taken 11491 times.
✓ Branch 8 taken 13719909 times.
✓ Branch 9 taken 18586582 times.
|
18583809 | if(dx<16-nb || dy<zc_max(16-yg-nb,0) || dx>=240+nb || dy>=160+nb) |
| 3719 | 27437045 | return true; | |
| 3720 | |||
| 3721 | 18586582 | bool isInDungeon = isdungeon(); | |
| 3722 |
4/4✓ Branch 0 taken 1186543 times.
✓ Branch 1 taken 17400039 times.
✓ Branch 2 taken 611 times.
✓ Branch 3 taken 1185932 times.
|
18586582 | if(isInDungeon || special==spw_wizzrobe) |
| 3723 | { | ||
| 3724 |
8/8✓ Branch 0 taken 3590853 times.
✓ Branch 1 taken 13809797 times.
✓ Branch 2 taken 3461474 times.
✓ Branch 3 taken 129379 times.
✓ Branch 4 taken 3550050 times.
✓ Branch 5 taken 10389126 times.
✓ Branch 6 taken 3550036 times.
✓ Branch 7 taken 14 times.
|
17400650 | if((input_x>=32 && dy<32-yg) || (input_y>-1000 && input_y<=144 && dy>=144)) |
| 3725 | 7011510 | return true; | |
| 3726 | |||
| 3727 |
8/8✓ Branch 0 taken 3502310 times.
✓ Branch 1 taken 6886830 times.
✓ Branch 2 taken 3403820 times.
✓ Branch 3 taken 98490 times.
✓ Branch 4 taken 3470454 times.
✓ Branch 5 taken 3514866 times.
✓ Branch 6 taken 3470451 times.
✓ Branch 7 taken 3 times.
|
10389140 | if((input_x>=32 && dx<32) || (input_x>-1000 && input_x<224 && dx>=224)) |
| 3728 |
2/2✓ Branch 0 taken 66592 times.
✓ Branch 1 taken 39 times.
|
6874271 | if(special!=spw_door) // walk in door way |
| 3729 | 66592 | return true; | |
| 3730 | 3514908 | } | |
| 3731 | |||
| 3732 |
6/6✓ Branch 0 taken 1886290 times.
✓ Branch 1 taken 2814550 times.
✓ Branch 2 taken 426366 times.
✓ Branch 3 taken 1459924 times.
✓ Branch 4 taken 34248 times.
✓ Branch 5 taken 392118 times.
|
4700840 | if(!(moveflags & FLAG_CAN_PITWALK) && (!(moveflags & FLAG_CAN_PITFALL) || !kb)) //Don't walk into pits, unless being knocked back |
| 3733 | { | ||
| 3734 |
3/4✓ Branch 0 taken 1852035 times.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1852035 times.
|
3704077 | if(ispitfall(dx,dy) || ispitfall(dx+8,dy) |
| 3735 |
2/4✓ Branch 0 taken 1852035 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1852035 times.
✗ Branch 3 not taken.
|
1852035 | || ispitfall(dx,dy+8) || ispitfall(dx+8,dy+8)) |
| 3736 | 7 | return true; | |
| 3737 | 1852035 | } | |
| 3738 | |||
| 3739 |
4/4✓ Branch 0 taken 3744867 times.
✓ Branch 1 taken 952464 times.
✓ Branch 2 taken 45 times.
✓ Branch 3 taken 3457 times.
|
4700833 | switch(special) |
| 3740 | { | ||
| 3741 | case spw_clipbottomright: | ||
| 3742 |
2/4✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45 times.
|
45 | if(dy>=128 || dx>=208) return true; |
| 3743 | 45 | break; | |
| 3744 | case spw_clipright: | ||
| 3745 | 3457 | break; //if(input_x>=208) return true; break; | |
| 3746 | |||
| 3747 | case spw_wizzrobe: // fall through | ||
| 3748 | case spw_floater: // Special case for fliers and wizzrobes - hack! | ||
| 3749 | { | ||
| 3750 |
2/2✓ Branch 0 taken 760029 times.
✓ Branch 1 taken 2984838 times.
|
3744867 | if(isInDungeon) |
| 3751 | { | ||
| 3752 |
3/4✓ Branch 0 taken 2984827 times.
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2984827 times.
|
2984838 | if(dy < 32-yg || dy >= 144) return true; |
| 3753 |
3/4✓ Branch 0 taken 2983993 times.
✓ Branch 1 taken 834 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2983993 times.
|
2984827 | if(dx < 32 || dx >= 224) return true; |
| 3754 | 2983993 | } | |
| 3755 | 3744022 | return false; | |
| 3756 | } | ||
| 3757 | } | ||
| 3758 | |||
| 3759 | 955966 | dx&=(special==spw_halfstep)?(~7):(~15); | |
| 3760 |
2/2✓ Branch 0 taken 224029 times.
✓ Branch 1 taken 731937 times.
|
955966 | dy&=(special==spw_halfstep || isSideViewGravity())?(~7):(~15); |
| 3761 | |||
| 3762 |
2/2✓ Branch 0 taken 109935 times.
✓ Branch 1 taken 846031 times.
|
955966 | if(special==spw_water) |
| 3763 |
2/2✓ Branch 0 taken 6433 times.
✓ Branch 1 taken 103502 times.
|
109935 | return (water_walkflag(dx,dy+8,1) || water_walkflag(dx+8,dy+8,1)); |
| 3764 | |||
| 3765 |
2/2✓ Branch 0 taken 841987 times.
✓ Branch 1 taken 4044 times.
|
846031 | if(get_bit(quest_rules,qr_ENEMY_BROKEN_TOP_HALF_SOLIDITY)) |
| 3766 | { | ||
| 3767 |
4/4✓ Branch 0 taken 637824 times.
✓ Branch 1 taken 204163 times.
✓ Branch 2 taken 632598 times.
✓ Branch 3 taken 5226 times.
|
1474585 | return _walkflag(dx,dy+8,1) || _walkflag(dx+8,dy+8,1) || |
| 3768 |
2/2✓ Branch 0 taken 2654 times.
✓ Branch 1 taken 629944 times.
|
632598 | groundblocked(dx,dy+8,kb) || groundblocked(dx+8,dy+8,kb); |
| 3769 | } | ||
| 3770 | else | ||
| 3771 | { | ||
| 3772 |
4/4✓ Branch 0 taken 3147 times.
✓ Branch 1 taken 897 times.
✓ Branch 2 taken 3122 times.
✓ Branch 3 taken 25 times.
|
7166 | return _walkflag(dx,dy,1) || _walkflag(dx+8,dy,1) || |
| 3773 |
4/4✓ Branch 0 taken 2980 times.
✓ Branch 1 taken 142 times.
✓ Branch 2 taken 2965 times.
✓ Branch 3 taken 15 times.
|
3122 | _walkflag(dx,dy+8,1) || _walkflag(dx+8,dy+8,1) || |
| 3774 |
3/4✓ Branch 0 taken 2884 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 2884 times.
✗ Branch 3 not taken.
|
2965 | groundblocked(dx,dy,kb) || groundblocked(dx+8,dy,kb) || |
| 3775 |
1/2✓ Branch 0 taken 2884 times.
✗ Branch 1 not taken.
|
2884 | groundblocked(dx,dy+8,kb) || groundblocked(dx+8,dy+8,kb); |
| 3776 | } | ||
| 3777 | 4901885 | } | |
| 3778 | |||
| 3779 | 405278 | bool enemy::isOnSideviewPlatform() | |
| 3780 | { | ||
| 3781 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 405278 times.
|
405278 | int32_t usewid = (SIZEflags&guyflagOVERRIDE_HIT_WIDTH) ? hxsz : 16; |
| 3782 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 405278 times.
|
405278 | int32_t usehei = (SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) ? hysz : 16; |
| 3783 |
5/6✓ Branch 0 taken 10306 times.
✓ Branch 1 taken 394972 times.
✓ Branch 2 taken 211 times.
✓ Branch 3 taken 10095 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 211 times.
|
405278 | if(y + usehei >= 176 && currscr>=0x70 && !(tmpscr->flags2&wfDOWN)) return true; //Bottom of the map |
| 3784 |
2/2✓ Branch 0 taken 1545 times.
✓ Branch 1 taken 403522 times.
|
405067 | if(check_slope(x, y+1, usewid, usehei)) return true; |
| 3785 |
2/2✓ Branch 0 taken 403522 times.
✓ Branch 1 taken 171814 times.
|
575336 | for(int32_t nx = x + 4; nx <= x + usewid - 4; nx+=16) |
| 3786 | { | ||
| 3787 |
2/2✓ Branch 0 taken 171814 times.
✓ Branch 1 taken 231708 times.
|
403522 | if(_walkflag(nx,y+usehei,1)) return true; |
| 3788 |
3/4✓ Branch 0 taken 171814 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 124010 times.
✓ Branch 3 taken 47804 times.
|
171814 | if(IGNORE_SIDEVIEW_PLATFORMS || ((int32_t(y)+usehei)%16)!=0) continue; |
| 3789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47804 times.
|
47804 | if(checkSVLadderPlatform(nx,y+usehei)) return true; |
| 3790 | 47804 | } | |
| 3791 | 171814 | return false; | |
| 3792 | 405278 | } | |
| 3793 | |||
| 3794 | // Stops playing the given sound only if there are no enemies left to play it | ||
| 3795 | 395827 | void enemy::stop_bgsfx(int32_t index) | |
| 3796 | { | ||
| 3797 |
2/2✓ Branch 0 taken 386307 times.
✓ Branch 1 taken 9520 times.
|
395827 | if(bgsfx<=0) |
| 3798 | 386307 | return; | |
| 3799 | |||
| 3800 | // Look for other enemies with the same bgsfx | ||
| 3801 |
2/2✓ Branch 0 taken 38890 times.
✓ Branch 1 taken 5578 times.
|
44468 | for(int32_t i=0; i<guys.Count(); i++) |
| 3802 | { | ||
| 3803 |
4/4✓ Branch 0 taken 32095 times.
✓ Branch 1 taken 6795 times.
✓ Branch 2 taken 3942 times.
✓ Branch 3 taken 28153 times.
|
38890 | if(i!=index && ((enemy*)guys.spr(i))->bgsfx==bgsfx) |
| 3804 | 3942 | return; | |
| 3805 | 34948 | } | |
| 3806 | |||
| 3807 | 5578 | stop_sfx(bgsfx); | |
| 3808 | 395827 | } | |
| 3809 | |||
| 3810 | |||
| 3811 | // to allow for different sfx on defeating enemy | ||
| 3812 | 20002 | void enemy::death_sfx() | |
| 3813 | { | ||
| 3814 |
1/2✓ Branch 0 taken 20002 times.
✗ Branch 1 not taken.
|
20002 | if(deadsfx > 0) sfx(deadsfx,pan(int32_t(x))); |
| 3815 | 20002 | } | |
| 3816 | |||
| 3817 | ✗ | void enemy::move(zfix dx,zfix dy) | |
| 3818 | { | ||
| 3819 | /*if(FFCore.getQuestHeaderInfo(vZelda) >= 0x255 && FFCore.getQuestHeaderInfo(vBuild) >= 50 ) | ||
| 3820 | { | ||
| 3821 | switch(family) | ||
| 3822 | { | ||
| 3823 | case eeFIRE: | ||
| 3824 | case eeOTHER: | ||
| 3825 | return; | ||
| 3826 | default: break; | ||
| 3827 | } | ||
| 3828 | if(family >= eeSCRIPT01 && family <= eeFFRIENDLY10 ) return; | ||
| 3829 | } | ||
| 3830 | */ | ||
| 3831 | ✗ | if(!watch && (!(isSideViewGravity()) || isOnSideviewPlatform() || !(moveflags & FLAG_OBEYS_GRAV) || !enemycanfall(id))) | |
| 3832 | { | ||
| 3833 | ✗ | x+=dx; | |
| 3834 | ✗ | y+=dy; | |
| 3835 | ✗ | } | |
| 3836 | ✗ | } | |
| 3837 | |||
| 3838 | 9596355 | void enemy::move(zfix s) | |
| 3839 | { | ||
| 3840 | /*if(FFCore.getQuestHeaderInfo(vZelda) >= 0x255 && FFCore.getQuestHeaderInfo(vBuild) >= 50 ) | ||
| 3841 | { | ||
| 3842 | switch(family) | ||
| 3843 | { | ||
| 3844 | case eeFIRE: | ||
| 3845 | case eeOTHER: | ||
| 3846 | return; | ||
| 3847 | default: break; | ||
| 3848 | } | ||
| 3849 | if(family >= eeSCRIPT01 && family <= eeFFRIENDLY10 ) return; | ||
| 3850 | }*/ | ||
| 3851 |
9/10✓ Branch 0 taken 9596316 times.
✓ Branch 1 taken 39 times.
✓ Branch 2 taken 87408 times.
✓ Branch 3 taken 9508908 times.
✓ Branch 4 taken 41759 times.
✓ Branch 5 taken 45649 times.
✓ Branch 6 taken 1890 times.
✓ Branch 7 taken 39869 times.
✓ Branch 8 taken 1890 times.
✗ Branch 9 not taken.
|
9596355 | if(!watch && (!(isSideViewGravity()) || isOnSideviewPlatform() || !enemycanfall(id) || !(moveflags & FLAG_OBEYS_GRAV))) |
| 3852 | { | ||
| 3853 | 9594426 | sprite::move(s); | |
| 3854 | 9594426 | } | |
| 3855 | 9596355 | } | |
| 3856 | |||
| 3857 | 21044 | void enemy::leave_item() | |
| 3858 | { | ||
| 3859 | 21044 | int32_t drop_item = select_dropitem(item_set, x, y); | |
| 3860 | 21044 | int32_t thedropset = item_set; | |
| 3861 | |||
| 3862 | 21044 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 3863 | 21044 | ev.clear(); | |
| 3864 | 21044 | ev.push_back(getUID()); | |
| 3865 | 21044 | ev.push_back(drop_item*10000); | |
| 3866 | 21044 | ev.push_back(thedropset*10000); | |
| 3867 | |||
| 3868 | 21044 | throwGenScriptEvent(GENSCR_EVENT_ENEMY_DROP_ITEM_1); | |
| 3869 | 21044 | drop_item = vbound(ev[1] / 10000,-2,255); | |
| 3870 | 21044 | thedropset = ev[2] / 10000; | |
| 3871 | 21044 | ev.clear(); | |
| 3872 |
1/2✓ Branch 0 taken 21044 times.
✗ Branch 1 not taken.
|
21044 | if(drop_item == -2) |
| 3873 | { | ||
| 3874 | ✗ | drop_item = select_dropitem(thedropset,x,y); | |
| 3875 | ✗ | } | |
| 3876 | |||
| 3877 |
6/6✓ Branch 0 taken 8283 times.
✓ Branch 1 taken 12761 times.
✓ Branch 2 taken 414 times.
✓ Branch 3 taken 7869 times.
✓ Branch 4 taken 48 times.
✓ Branch 5 taken 366 times.
|
21044 | if(drop_item>=0&&((itemsbuf[drop_item].family!=itype_fairy)||!m_walkflag(x,y,0,dir))) |
| 3878 | { | ||
| 3879 | item* itm; | ||
| 3880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8235 times.
|
8235 | if (get_bit(quest_rules, qr_ENEMY_DROPS_USE_HITOFFSETS)) |
| 3881 | { | ||
| 3882 | ✗ | itm = (new item(x+hxofs+(hxsz/2)-8,y+hyofs+(hysz/2)-8,(zfix)0,drop_item,ipBIGRANGE+ipTIMER,0)); | |
| 3883 | ✗ | } | |
| 3884 | else | ||
| 3885 | { | ||
| 3886 |
8/14✓ Branch 0 taken 473 times.
✓ Branch 1 taken 7762 times.
✓ Branch 2 taken 473 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 473 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 473 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 473 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 473 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 473 times.
✗ Branch 13 not taken.
|
8235 | if(extend >= 3) itm = (new item(x+(txsz-1)*8,y+(tysz-1)*8,(zfix)0,drop_item,ipBIGRANGE+ipTIMER,0)); |
| 3887 |
4/8✓ Branch 0 taken 7762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7762 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7762 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7762 times.
✗ Branch 7 not taken.
|
7762 | else itm = (new item(x,y,(zfix)0,drop_item,ipBIGRANGE+ipTIMER,0)); |
| 3888 | } | ||
| 3889 | 8235 | itm->from_dropset = thedropset; | |
| 3890 | 8235 | items.add(itm); | |
| 3891 | |||
| 3892 | 8235 | ev.push_back(getUID()); | |
| 3893 | 8235 | ev.push_back(itm->getUID()); | |
| 3894 | |||
| 3895 | 8235 | throwGenScriptEvent(GENSCR_EVENT_ENEMY_DROP_ITEM_2); | |
| 3896 | 8235 | ev.clear(); | |
| 3897 | 8235 | } | |
| 3898 | 21044 | } | |
| 3899 | |||
| 3900 | // auomatically kill off enemy (for rooms with ringleaders) | ||
| 3901 | 293 | void enemy::kickbucket() | |
| 3902 | { | ||
| 3903 |
2/2✓ Branch 0 taken 268 times.
✓ Branch 1 taken 25 times.
|
293 | if(!superman) |
| 3904 | 268 | hp=-1000; // don't call death_sfx() | |
| 3905 | 293 | } | |
| 3906 | |||
| 3907 | 42798 | bool enemy::isSubmerged() const | |
| 3908 | { | ||
| 3909 | 42798 | return submerged; | |
| 3910 | //!TODO SOLIDPUSH more things like teleporting wizzrobes | ||
| 3911 | } | ||
| 3912 | |||
| 3913 | 17356 | void enemy::FireBreath(bool seekhero) | |
| 3914 | { | ||
| 3915 |
1/2✓ Branch 0 taken 17356 times.
✗ Branch 1 not taken.
|
17356 | if(wpn==wNone) |
| 3916 | ✗ | return; | |
| 3917 | |||
| 3918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17356 times.
|
17356 | if(wpn==ewFireTrail) |
| 3919 | { | ||
| 3920 | ✗ | dmisc1 = e1tEACHTILE; | |
| 3921 | ✗ | FireWeapon(); | |
| 3922 | ✗ | return; | |
| 3923 | } | ||
| 3924 | |||
| 3925 | 17356 | float fire_angle=0.0; | |
| 3926 | 17356 | int32_t wx=0, wy=0, wdir=dir; | |
| 3927 | |||
| 3928 |
2/2✓ Branch 0 taken 1652 times.
✓ Branch 1 taken 15704 times.
|
17356 | if(!seekhero) |
| 3929 | { | ||
| 3930 |
4/5✓ Branch 0 taken 3271 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3038 times.
✓ Branch 3 taken 5264 times.
✓ Branch 4 taken 4131 times.
|
15704 | switch(dir) |
| 3931 | { | ||
| 3932 | case down: | ||
| 3933 | 3038 | fire_angle=PI*(int64_t(zc_oldrand()%20)+10)/40; | |
| 3934 | 3038 | wx=x; | |
| 3935 | 3038 | wy=y+8; | |
| 3936 | 3038 | break; | |
| 3937 | |||
| 3938 | case -1: | ||
| 3939 | case up: | ||
| 3940 | 3271 | fire_angle=PI*(int64_t(zc_oldrand()%20)+50)/40; | |
| 3941 | 3271 | wx=x; | |
| 3942 | 3271 | wy=y-8; | |
| 3943 | 3271 | break; | |
| 3944 | |||
| 3945 | case left: | ||
| 3946 | 5264 | fire_angle=PI*(int64_t(zc_oldrand()%20)+30)/40; | |
| 3947 | 5264 | wx=x-8; | |
| 3948 | 5264 | wy=y; | |
| 3949 | 5264 | break; | |
| 3950 | |||
| 3951 | case right: | ||
| 3952 | 4131 | fire_angle=PI*(int64_t(zc_oldrand()%20)+70)/40; | |
| 3953 | 4131 | wx=x+8; | |
| 3954 | 4131 | wy=y; | |
| 3955 | 4131 | break; | |
| 3956 | } | ||
| 3957 | |||
| 3958 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15704 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15704 | if(wpn==ewFlame || wpn==ewFlame2) |
| 3959 | { | ||
| 3960 |
2/4✓ Branch 0 taken 15704 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15704 times.
|
15704 | if(fire_angle==-PI || fire_angle==PI) wdir=left; |
| 3961 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15704 times.
|
15704 | else if(fire_angle==-PI/2) wdir=up; |
| 3962 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15704 times.
|
15704 | else if(fire_angle==PI/2) wdir=down; |
| 3963 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15704 times.
|
15704 | else if(fire_angle==0) wdir=right; |
| 3964 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15704 times.
|
15704 | else if(fire_angle<-PI/2) wdir=l_up; |
| 3965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15704 times.
|
15704 | else if(fire_angle<0) wdir=r_up; |
| 3966 |
2/2✓ Branch 0 taken 1498 times.
✓ Branch 1 taken 14206 times.
|
15704 | else if(fire_angle<(PI/2)) wdir=r_down; |
| 3967 |
2/2✓ Branch 0 taken 10090 times.
✓ Branch 1 taken 4116 times.
|
14206 | else if(fire_angle<PI) wdir=l_down; |
| 3968 | 15704 | } | |
| 3969 | 15704 | } | |
| 3970 | else | ||
| 3971 | { | ||
| 3972 | 1652 | wx = x; | |
| 3973 | 1652 | wy = y; | |
| 3974 | } | ||
| 3975 | |||
| 3976 |
2/2✓ Branch 0 taken 1652 times.
✓ Branch 1 taken 15704 times.
|
17356 | addEwpn(wx,wy,z,wpn,2,wdp,seekhero ? 0xFF : wdir, getUID(), 0, fakez); |
| 3977 | 17356 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 3978 | |||
| 3979 | 17356 | int32_t i=Ewpns.Count()-1; | |
| 3980 | 17356 | weapon *ew = (weapon*)(Ewpns.spr(i)); | |
| 3981 | 17356 | ew->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 3982 | |||
| 3983 |
4/4✓ Branch 0 taken 15704 times.
✓ Branch 1 taken 1652 times.
✓ Branch 2 taken 7830 times.
✓ Branch 3 taken 7874 times.
|
17356 | if(!seekhero && (zc_oldrand()&4)) |
| 3984 | { | ||
| 3985 | 7874 | ew->angular=true; | |
| 3986 | 7874 | ew->angle=fire_angle; | |
| 3987 | 7874 | } | |
| 3988 | |||
| 3989 |
4/4✓ Branch 0 taken 17299 times.
✓ Branch 1 taken 57 times.
✓ Branch 2 taken 317 times.
✓ Branch 3 taken 16982 times.
|
17356 | if(wpn==ewFlame && wpnsbuf[ewFLAME].frames>1) |
| 3990 | { | ||
| 3991 | 16982 | ew->aframe=zc_oldrand()%wpnsbuf[ewFLAME].frames; | |
| 3992 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16982 times.
|
16982 | if ( ew->do_animation ) ew->tile+=ew->aframe; |
| 3993 | 16982 | } | |
| 3994 | |||
| 3995 |
2/2✓ Branch 0 taken 17356 times.
✓ Branch 1 taken 542966 times.
|
560322 | for(int32_t j=Ewpns.Count()-1; j>0; j--) |
| 3996 | { | ||
| 3997 | 542966 | Ewpns.swap(j,j-1); | |
| 3998 | 542966 | } | |
| 3999 | 17356 | } | |
| 4000 | |||
| 4001 | 25747 | void enemy::FireWeapon() | |
| 4002 | { | ||
| 4003 | /* | ||
| 4004 | * Type: | ||
| 4005 | * 0x01: Boss fireball | ||
| 4006 | * 0x02: Seeks Hero | ||
| 4007 | * 0x04: Fast projectile | ||
| 4008 | * 0x00-0x30: If 0x02, slants toward (type>>3)-1 | ||
| 4009 | */ | ||
| 4010 | |||
| 4011 |
2/2✓ Branch 0 taken 25737 times.
✓ Branch 1 taken 10 times.
|
25747 | if (wpn < 1) return; |
| 4012 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 25737 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
25737 | if(wpn<wEnemyWeapons && dmisc1!=9 && dmisc1!=10 && (wpn < wScript1 && wpn > wScript10) ) // Summoning doesn't require weapons |
| 4013 | ✗ | return; | |
| 4014 | |||
| 4015 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 25737 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
25737 | if(wpn==ewFireTrail && dmisc1>=e1t3SHOTS && dmisc1<=e1t8SHOTS) |
| 4016 | ✗ | dmisc1 = e1tEACHTILE; | |
| 4017 | |||
| 4018 | 25737 | int32_t xoff = 0; | |
| 4019 | 25737 | int32_t yoff = 0; | |
| 4020 |
1/2✓ Branch 0 taken 25737 times.
✗ Branch 1 not taken.
|
25737 | if ( SIZEflags&guyflagOVERRIDE_HIT_WIDTH ) |
| 4021 | { | ||
| 4022 | ✗ | xoff += (hxsz/2)-8; | |
| 4023 | //Z_scripterrlog("width flag enabled. xoff = %d\n", xoff); | ||
| 4024 | ✗ | } | |
| 4025 |
1/2✓ Branch 0 taken 25737 times.
✗ Branch 1 not taken.
|
25737 | if ( SIZEflags&guyflagOVERRIDE_HIT_HEIGHT ) |
| 4026 | { | ||
| 4027 | ✗ | yoff += (hysz/2)-8; | |
| 4028 | //Z_scripterrlog("width flag enabled. yoff = %d\n", yoff); | ||
| 4029 | ✗ | } | |
| 4030 | |||
| 4031 |
4/8✓ Branch 0 taken 413 times.
✓ Branch 1 taken 24326 times.
✓ Branch 2 taken 589 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 409 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
25737 | switch(dmisc1) |
| 4032 | { | ||
| 4033 | case e1t5SHOTS: //BS-Aquamentus | ||
| 4034 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,2+(((dir^left)+5)<<3),wdp,dir,-1, getUID(),false)); | |
| 4035 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4036 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,2+(((dir^right)+5)<<3),wdp,dir,-1, getUID(),false)); | |
| 4037 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4038 | |||
| 4039 | [[fallthrough]]; | ||
| 4040 | case e1t3SHOTSFAST: | ||
| 4041 | case e1t3SHOTS: //Aquamentus | ||
| 4042 |
7/14✓ Branch 0 taken 413 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 413 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 413 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 413 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 413 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 413 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 413 times.
✗ Branch 13 not taken.
|
413 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,2+(((dir^left)+1)<<3)+(dmisc1==e1t3SHOTSFAST ? 4:0),wdp,dir,-1, getUID(),false)); |
| 4043 | 413 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4044 |
7/14✓ Branch 0 taken 413 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 413 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 413 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 413 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 413 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 413 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 413 times.
✗ Branch 13 not taken.
|
413 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,2+(((dir^right)+1)<<3)+(dmisc1==e1t3SHOTSFAST ? 4:0),wdp,dir,-1, getUID(),false)); |
| 4045 | 413 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4046 | |||
| 4047 | [[fallthrough]]; | ||
| 4048 | default: | ||
| 4049 |
11/20✓ Branch 0 taken 24739 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24739 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 24739 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 24739 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 24739 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 24739 times.
✓ Branch 12 taken 24739 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 10988 times.
✓ Branch 15 taken 13751 times.
✓ Branch 16 taken 24739 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 24739 times.
✗ Branch 19 not taken.
|
24739 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,2+(dmisc1==e1t3SHOTSFAST || dmisc1==e1tFAST ? 4:0),wdp,wpn==ewFireball2 || wpn==ewFireball ? 0:dir,-1, getUID(),false)); |
| 4050 | 24739 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4051 | 24739 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 4052 | 24739 | break; | |
| 4053 | |||
| 4054 | case e1tSLANT: | ||
| 4055 | { | ||
| 4056 | 409 | int32_t slant = 0; | |
| 4057 | |||
| 4058 |
10/10✓ Branch 0 taken 105 times.
✓ Branch 1 taken 304 times.
✓ Branch 2 taken 197 times.
✓ Branch 3 taken 212 times.
✓ Branch 4 taken 45 times.
✓ Branch 5 taken 152 times.
✓ Branch 6 taken 60 times.
✓ Branch 7 taken 304 times.
✓ Branch 8 taken 131 times.
✓ Branch 9 taken 173 times.
|
409 | if(((Hero.x-x) < -8 && dir==up) || ((Hero.x-x) > 8 && dir==down) || ((Hero.y-y) < -8 && dir==left) || ((Hero.y-y) > 8 && dir==right)) |
| 4059 | 236 | slant = left; | |
| 4060 |
10/10✓ Branch 0 taken 94 times.
✓ Branch 1 taken 79 times.
✓ Branch 2 taken 64 times.
✓ Branch 3 taken 109 times.
✓ Branch 4 taken 37 times.
✓ Branch 5 taken 27 times.
✓ Branch 6 taken 51 times.
✓ Branch 7 taken 85 times.
✓ Branch 8 taken 24 times.
✓ Branch 9 taken 61 times.
|
173 | else if(((Hero.x-x) > 8 && dir==up) || ((Hero.x-x) < -8 && dir==down) || ((Hero.y-y) > 8 && dir==left) || ((Hero.y-y) < -8 && dir==right)) |
| 4061 | 112 | slant = right; | |
| 4062 | |||
| 4063 |
9/18✓ Branch 0 taken 319 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 319 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 319 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 319 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 319 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 319 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 319 times.
✓ Branch 14 taken 319 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 319 times.
✗ Branch 17 not taken.
|
319 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,2+(((dir^slant)+1)<<3),wdp,wpn==ewFireball2 || wpn==ewFireball ? 0:dir,-1, getUID(),false)); |
| 4064 | 319 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4065 | 319 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 4066 | 319 | break; | |
| 4067 | } | ||
| 4068 | |||
| 4069 | case e1t8SHOTS: //Fire Wizzrobe | ||
| 4070 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,l_up,-1, getUID(),false)); | |
| 4071 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4072 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4073 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,l_down,-1, getUID(),false)); | |
| 4074 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4075 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4076 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,r_up,-1, getUID(),false)); | |
| 4077 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4078 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4079 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,r_down,-1, getUID(),false)); | |
| 4080 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4081 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4082 | |||
| 4083 | [[fallthrough]]; | ||
| 4084 | case e1t4SHOTS: //Stalfos 3 | ||
| 4085 |
7/14✓ Branch 0 taken 589 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 589 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 589 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 589 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 589 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 589 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 589 times.
✗ Branch 13 not taken.
|
589 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,up,-1, getUID(),false)); |
| 4086 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4087 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4088 |
7/14✓ Branch 0 taken 589 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 589 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 589 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 589 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 589 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 589 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 589 times.
✗ Branch 13 not taken.
|
589 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,down,-1, getUID(),false)); |
| 4089 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4090 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4091 |
7/14✓ Branch 0 taken 589 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 589 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 589 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 589 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 589 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 589 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 589 times.
✗ Branch 13 not taken.
|
589 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,left,-1, getUID(),false)); |
| 4092 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4093 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4094 |
7/14✓ Branch 0 taken 589 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 589 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 589 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 589 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 589 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 589 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 589 times.
✗ Branch 13 not taken.
|
589 | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,0,wdp,right,-1, getUID(),false)); |
| 4095 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 4096 | 589 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 4097 | 589 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 4098 | 589 | break; | |
| 4099 | |||
| 4100 | case e1tSUMMON: // Bat Wizzrobe | ||
| 4101 | { | ||
| 4102 | //al_trace("Summon Bats\n"); | ||
| 4103 | //zprint2("Summon Bats\n"); | ||
| 4104 | ✗ | if(dmisc4==0) break; // Summon 0 | |
| 4105 | |||
| 4106 | ✗ | int32_t bc=0; | |
| 4107 | |||
| 4108 | ✗ | for(int32_t gc=0; gc<guys.Count(); gc++) | |
| 4109 | { | ||
| 4110 | ✗ | if((((enemy*)guys.spr(gc))->id) == dmisc3) | |
| 4111 | { | ||
| 4112 | ✗ | ++bc; | |
| 4113 | ✗ | } | |
| 4114 | ✗ | } | |
| 4115 | |||
| 4116 | ✗ | if(bc<=40) // Not too many enemies | |
| 4117 | { | ||
| 4118 | ✗ | int32_t kids = guys.Count(); | |
| 4119 | ✗ | int32_t bats=(zc_oldrand()%zc_max(1,dmisc4))+1; | |
| 4120 | |||
| 4121 | ✗ | for(int32_t i=0; i<bats; i++) | |
| 4122 | { | ||
| 4123 | //zprint2("summon\n"); | ||
| 4124 | //al_trace("summon\n"); | ||
| 4125 | ✗ | if(addchild(x,y,dmisc3,-10, this->script_UID)) | |
| 4126 | { | ||
| 4127 | ✗ | ((enemy*)guys.spr(kids+i))->count_enemy = false; | |
| 4128 | //((enemy*)guys.spr(guys.Count()-1))->parent_script_UID = this->script_UID; | ||
| 4129 | //zprint2("Summoner Script UID: %d\n",this->script_UID); | ||
| 4130 | |||
| 4131 | ✗ | } | |
| 4132 | ✗ | } | |
| 4133 | |||
| 4134 | ✗ | sfx(get_bit(quest_rules,qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE,pan(int32_t(x))); | |
| 4135 | ✗ | } | |
| 4136 | |||
| 4137 | ✗ | break; | |
| 4138 | } | ||
| 4139 | |||
| 4140 | case e1tSUMMONLAYER: // Summoner | ||
| 4141 | { | ||
| 4142 | ✗ | if(count_layer_enemies()==0) | |
| 4143 | { | ||
| 4144 | ✗ | break; | |
| 4145 | } | ||
| 4146 | |||
| 4147 | ✗ | int32_t kids = guys.Count(); | |
| 4148 | |||
| 4149 | ✗ | if(kids<40) | |
| 4150 | { | ||
| 4151 | ✗ | int32_t newguys=(zc_oldrand()%3)+1; | |
| 4152 | ✗ | bool summoned=false; | |
| 4153 | |||
| 4154 | ✗ | for(int32_t i=0; i<newguys; i++) | |
| 4155 | { | ||
| 4156 | ✗ | int32_t id2=vbound(random_layer_enemy(),eSTART,eMAXGUYS-1); | |
| 4157 | ✗ | int32_t x2=0; | |
| 4158 | ✗ | int32_t y2=0; | |
| 4159 | |||
| 4160 | ✗ | for(int32_t k=0; k<20; ++k) | |
| 4161 | { | ||
| 4162 | ✗ | x2=16*((zc_oldrand()%12)+2); | |
| 4163 | ✗ | y2=16*((zc_oldrand()%7)+2); | |
| 4164 | |||
| 4165 | ✗ | if((!m_walkflag(x2,y2,0,dir))&&((abs(x2-Hero.getX())>=32)||(abs(y2-Hero.getY())>=32))) | |
| 4166 | { | ||
| 4167 | //zprint2("summon\n"); | ||
| 4168 | //al_trace("summon\n"); | ||
| 4169 | ✗ | if(addchild(x2,y2,get_bit(quest_rules,qr_ENEMIESZAXIS) ? 64 : 0,id2,-10, this->script_UID)) | |
| 4170 | { | ||
| 4171 | ✗ | ((enemy*)guys.spr(kids+i))->count_enemy = false; | |
| 4172 | //((enemy*)guys.spr(guys.Count()-1))->parent_script_UID = this->script_UID; | ||
| 4173 | ✗ | if (get_bit(quest_rules,qr_ENEMIESZAXIS) && (((enemy*)guys.spr(kids+i))->moveflags & FLAG_USE_FAKE_Z)) | |
| 4174 | { | ||
| 4175 | ✗ | ((enemy*)guys.spr(kids+i))->fakez = 64; | |
| 4176 | ✗ | ((enemy*)guys.spr(kids+i))->z = 0; | |
| 4177 | ✗ | } | |
| 4178 | ✗ | } | |
| 4179 | |||
| 4180 | ✗ | summoned=true; | |
| 4181 | ✗ | break; | |
| 4182 | } | ||
| 4183 | ✗ | } | |
| 4184 | ✗ | } | |
| 4185 | |||
| 4186 | ✗ | if(summoned) | |
| 4187 | { | ||
| 4188 | ✗ | sfx(get_bit(quest_rules,qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE,pan(int32_t(x))); | |
| 4189 | ✗ | } | |
| 4190 | ✗ | } | |
| 4191 | |||
| 4192 | ✗ | break; | |
| 4193 | } | ||
| 4194 | } | ||
| 4195 | 25657 | } | |
| 4196 | |||
| 4197 | |||
| 4198 | // Hit the shield(s)? | ||
| 4199 | // Apparently, this function is only used for hookshots... | ||
| 4200 | 398 | bool enemy::hitshield(int32_t wpnx, int32_t wpny, int32_t xdir) | |
| 4201 | { | ||
| 4202 |
4/6✓ Branch 0 taken 106 times.
✓ Branch 1 taken 292 times.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 106 times.
|
398 | if(!(family==eeWALK || family==eeFIRE || family==eeOTHER)) |
| 4203 | 106 | return false; | |
| 4204 | |||
| 4205 | 292 | bool ret = false; | |
| 4206 | |||
| 4207 | // TODO: There must be some bitwise operations that can simplify this... | ||
| 4208 |
9/12✓ Branch 0 taken 137 times.
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 123 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 129 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 129 times.
✓ Branch 10 taken 129 times.
✗ Branch 11 not taken.
|
292 | if(wpny > y) ret = ((flags&inv_front && xdir==down) || (flags&inv_back && xdir==up) || (flags&inv_left && xdir==left) || (flags&inv_right && xdir==right)); |
| 4209 |
9/12✓ Branch 0 taken 65 times.
✓ Branch 1 taken 90 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 82 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 90 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 94 times.
✓ Branch 10 taken 94 times.
✗ Branch 11 not taken.
|
155 | else if(wpny < y) ret = ((flags&inv_front && xdir==up) || (flags&inv_back && xdir==down) || (flags&inv_left && xdir==right) || (flags&inv_right && xdir==left)); |
| 4210 | |||
| 4211 |
11/14✓ Branch 0 taken 115 times.
✓ Branch 1 taken 185 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 107 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 95 times.
✓ Branch 6 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 101 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 101 times.
✓ Branch 12 taken 101 times.
✗ Branch 13 not taken.
|
300 | if(wpnx < x) ret = ret || ((flags&inv_front && xdir==left) || (flags&inv_back && xdir==right) || (flags&inv_left && xdir==up) || (flags&inv_right && xdir==down)); |
| 4212 |
10/14✓ Branch 0 taken 40 times.
✓ Branch 1 taken 145 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 144 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 141 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 141 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 141 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 141 times.
|
185 | else if(wpnx > x) ret = ret || ((flags&inv_front && xdir==right) || (flags&inv_back && xdir==left) || (flags&inv_left && xdir==down) || (flags&inv_right && xdir==up)); |
| 4213 | |||
| 4214 | 300 | return ret; | |
| 4215 | 406 | } | |
| 4216 | |||
| 4217 | |||
| 4218 | //! Weapon Editor for 2.6 | ||
| 4219 | //To hell with this. I'm writing new functions to resolve weapon type and defence. -Z | ||
| 4220 | |||
| 4221 | |||
| 4222 | //converts a wqeapon ID to its defence index. | ||
| 4223 | 67140 | int32_t weaponToDefence(int32_t wid) | |
| 4224 | { | ||
| 4225 |
20/44✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 30640 times.
✓ Branch 3 taken 6751 times.
✓ Branch 4 taken 17048 times.
✓ Branch 5 taken 654 times.
✓ Branch 6 taken 27 times.
✓ Branch 7 taken 48 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1261 times.
✓ Branch 10 taken 5722 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 163 times.
✓ Branch 14 taken 817 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 322 times.
✓ Branch 18 taken 920 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 866 times.
✓ Branch 21 taken 406 times.
✓ Branch 22 taken 118 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 325 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✓ Branch 29 taken 11 times.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 33 taken 12 times.
✓ Branch 34 taken 77 times.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✓ Branch 40 taken 952 times.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
|
67140 | switch(wid) |
| 4226 | { | ||
| 4227 | ✗ | case wNone: return -1; | |
| 4228 | 30640 | case wSword: return edefSWORD; | |
| 4229 | 6751 | case wBeam: return edefBEAM; | |
| 4230 | 17048 | case wBrang: return edefBRANG; | |
| 4231 | 654 | case wBomb: return edefBOMB; | |
| 4232 | 27 | case wSBomb: return edefSBOMB; | |
| 4233 | 48 | case wLitBomb: return edefBOMB; | |
| 4234 | ✗ | case wLitSBomb: return edefSBOMB; | |
| 4235 | 1261 | case wArrow: return edefARROW; | |
| 4236 | 5722 | case wFire: return edefFIRE; | |
| 4237 | case wWhistle: | ||
| 4238 | { | ||
| 4239 | //al_trace("Weapon resolved as a whistle, using edef: %s\n", "edefWhistle"); | ||
| 4240 | ✗ | return edefWhistle; | |
| 4241 | } | ||
| 4242 | ✗ | case wBait: return edefBAIT; | |
| 4243 | 163 | case wWand: return edefWAND; | |
| 4244 | 817 | case wMagic: return edefMAGIC; | |
| 4245 | ✗ | case wCatching: return -1; | |
| 4246 | ✗ | case wWind: return edefWIND; | |
| 4247 | 322 | case wRefMagic: return edefREFMAGIC; | |
| 4248 | 920 | case wRefFireball: return edefREFBALL; | |
| 4249 | ✗ | case wRefRock: return edefREFROCK; | |
| 4250 | 866 | case wHammer: return edefHAMMER; | |
| 4251 | 406 | case wHookshot: return edefHOOKSHOT; | |
| 4252 | 118 | case wHSHandle: return edefHOOKSHOT; | |
| 4253 | ✗ | case wHSChain: return edefHOOKSHOT; | |
| 4254 | ✗ | case wSSparkle: return edefSPARKLE; | |
| 4255 | 325 | case wFSparkle: return edefSPARKLE; | |
| 4256 | ✗ | case wSmack: return -1; // is this the candle object? | |
| 4257 | ✗ | case wPhantom: return -1; //engine created visual effects. | |
| 4258 | ✗ | case wCByrna: return edefBYRNA; | |
| 4259 | 11 | case wRefBeam: return edefREFBEAM; | |
| 4260 | ✗ | case wStomp: return edefSTOMP; | |
| 4261 | ✗ | case wScript1: return edefSCRIPT01; | |
| 4262 | ✗ | case wScript2: return edefSCRIPT02; | |
| 4263 | 12 | case wScript3: return edefSCRIPT03; | |
| 4264 | 77 | case wScript4: return edefSCRIPT04; | |
| 4265 | ✗ | case wScript5: return edefSCRIPT05; | |
| 4266 | ✗ | case wScript6: return edefSCRIPT06; | |
| 4267 | ✗ | case wScript7: return edefSCRIPT07; | |
| 4268 | ✗ | case wScript8: return edefSCRIPT08; | |
| 4269 | ✗ | case wScript9: return edefSCRIPT09; | |
| 4270 | 952 | case wScript10: return edefSCRIPT10; | |
| 4271 | ✗ | case wIce: return edefICE; | |
| 4272 | ✗ | case wSound: return edefSONIC; | |
| 4273 | ✗ | case wThrown: return edefTHROWN; | |
| 4274 | //case wPot: return edefPOT; | ||
| 4275 | // case wLitZap: return edefELECTRIC; | ||
| 4276 | // case wZ3Sword: return edefZ3SWORD; | ||
| 4277 | // case wLASWord: return edefLASWORD; | ||
| 4278 | // case wSpinAttk: return edefSPINATTK; | ||
| 4279 | // case wShield: return edefSHIELD; | ||
| 4280 | // case wTrowel: return edefTROWEL; | ||
| 4281 | |||
| 4282 | ✗ | default: return -1; | |
| 4283 | } | ||
| 4284 | 67140 | } | |
| 4285 | |||
| 4286 | 67140 | int32_t getDefType(weapon *w) | |
| 4287 | { | ||
| 4288 | 67140 | int32_t id = getWeaponID(w); | |
| 4289 | 67140 | int32_t edef = weaponToDefence(id); | |
| 4290 |
2/2✓ Branch 0 taken 66616 times.
✓ Branch 1 taken 524 times.
|
67140 | if(edef == edefHOOKSHOT) |
| 4291 | { | ||
| 4292 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 524 times.
|
524 | if(w->family_class == itype_switchhook) |
| 4293 | ✗ | return edefSwitchHook; | |
| 4294 | 524 | } | |
| 4295 | 67140 | return edef; | |
| 4296 | 67140 | } | |
| 4297 | |||
| 4298 | 116826 | int32_t getWeaponID(weapon *w) | |
| 4299 | { | ||
| 4300 | 116826 | int32_t usewpn = w->useweapon; | |
| 4301 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116826 times.
|
116826 | return (usewpn > 0) ? usewpn : w->id; |
| 4302 | } | ||
| 4303 | |||
| 4304 | 67140 | int32_t enemy::resolveEnemyDefence(weapon *w) | |
| 4305 | { | ||
| 4306 | //sword edef is 9, but we're reading it at 0 | ||
| 4307 | //, | ||
| 4308 | 67140 | int32_t weapondef = 0; | |
| 4309 | 67140 | int32_t wdeftype = getDefType(w); | |
| 4310 | 67140 | int32_t usedef = w->usedefence; | |
| 4311 | |||
| 4312 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 67140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
67140 | if ( usedef > 0 && (wdeftype < 0 || wdeftype >= edefLAST255 || defense[wdeftype] == 0)) |
| 4313 | { | ||
| 4314 | ✗ | weapondef = usedef*-1; | |
| 4315 | ✗ | } | |
| 4316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67140 times.
|
67140 | else if(unsigned(wdeftype) < edefLAST255) |
| 4317 | { | ||
| 4318 | 67140 | weapondef = wdeftype; | |
| 4319 | 67140 | } | |
| 4320 | 67140 | return weapondef; | |
| 4321 | } | ||
| 4322 | |||
| 4323 | 72791 | byte get_def_ignrflag(int32_t edef) | |
| 4324 | { | ||
| 4325 |
3/3✓ Branch 0 taken 61305 times.
✓ Branch 1 taken 2312 times.
✓ Branch 2 taken 9174 times.
|
72791 | switch(edef) |
| 4326 | { | ||
| 4327 | case edIGNORE: | ||
| 4328 | case edIGNOREL1: | ||
| 4329 | case edSTUNORIGNORE: | ||
| 4330 | 9174 | return WPNUNB_IGNR; | |
| 4331 | case edSTUNORCHINK: | ||
| 4332 | case edCHINK: | ||
| 4333 | case edCHINKL1: | ||
| 4334 | case edCHINKL2: | ||
| 4335 | case edCHINKL4: | ||
| 4336 | case edCHINKL6: | ||
| 4337 | case edCHINKL8: | ||
| 4338 | case edCHINKL10: | ||
| 4339 | case edLEVELCHINK2: | ||
| 4340 | case edLEVELCHINK3: | ||
| 4341 | case edLEVELCHINK4: | ||
| 4342 | case edLEVELCHINK5: | ||
| 4343 | 2312 | return WPNUNB_BLOCK; | |
| 4344 | } | ||
| 4345 | 61305 | return 0; | |
| 4346 | 72791 | } | |
| 4347 | |||
| 4348 | 72791 | int32_t conv_edef_unblockable(int32_t edef, byte unblockable) | |
| 4349 | { | ||
| 4350 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72791 times.
|
72791 | if(!(unblockable&get_def_ignrflag(edef))) return edef; |
| 4351 | ✗ | switch(edef) | |
| 4352 | { | ||
| 4353 | case edIGNORE: | ||
| 4354 | case edIGNOREL1: | ||
| 4355 | case edCHINK: | ||
| 4356 | case edCHINKL1: | ||
| 4357 | case edCHINKL2: | ||
| 4358 | case edCHINKL4: | ||
| 4359 | case edCHINKL6: | ||
| 4360 | case edCHINKL8: | ||
| 4361 | case edCHINKL10: | ||
| 4362 | case edLEVELCHINK2: | ||
| 4363 | case edLEVELCHINK3: | ||
| 4364 | case edLEVELCHINK4: | ||
| 4365 | case edLEVELCHINK5: | ||
| 4366 | ✗ | return edNORMAL; | |
| 4367 | case edSTUNORIGNORE: | ||
| 4368 | case edSTUNORCHINK: | ||
| 4369 | ✗ | return edSTUNONLY; | |
| 4370 | } | ||
| 4371 | ✗ | return edef; | |
| 4372 | 72791 | } | |
| 4373 | |||
| 4374 | // Do we do damage? | ||
| 4375 | // 0: takehit returns 0 | ||
| 4376 | // 1: takehit returns 1 | ||
| 4377 | // -1: do damage | ||
| 4378 | //The input from resolveEnemyDefence() for the param 'edef' is negative if a specific defence RESULT is being used. | ||
| 4379 | 66188 | int32_t enemy::defendNew(int32_t wpnId, int32_t *power, int32_t edef, byte unblockable) //May need *wpn to set return on brangs and hookshots | |
| 4380 | { | ||
| 4381 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 66188 times.
|
66188 | if(switch_hooked) return 0; |
| 4382 | 66188 | int32_t tempx = x; | |
| 4383 | 66188 | int32_t tempy = y; | |
| 4384 | 66188 | int32_t the_defence = 0; | |
| 4385 |
1/2✓ Branch 0 taken 66188 times.
✗ Branch 1 not taken.
|
66188 | if ( edef < 0 ) //we are using a specific base default defence for a weapon |
| 4386 | { | ||
| 4387 | ✗ | the_defence = edef*-1; //A specific defence type. | |
| 4388 | ✗ | } | |
| 4389 | 66188 | else the_defence = defense[edef]; | |
| 4390 | |||
| 4391 | 66188 | the_defence = conv_edef_unblockable(the_defence, unblockable); | |
| 4392 | |||
| 4393 |
3/4✓ Branch 0 taken 4257 times.
✓ Branch 1 taken 61931 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4257 times.
|
66188 | if(shieldCanBlock && !(unblockable&WPNUNB_SHLD)) |
| 4394 | { | ||
| 4395 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 4256 times.
✓ Branch 2 taken 1 times.
|
4257 | switch(the_defence) |
| 4396 | { | ||
| 4397 | case edIGNORE: | ||
| 4398 | 1 | return 0; | |
| 4399 | case edIGNOREL1: | ||
| 4400 | case edSTUNORIGNORE: | ||
| 4401 | ✗ | if(*power <= 0) | |
| 4402 | ✗ | return 0; | |
| 4403 | ✗ | } | |
| 4404 | 4256 | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 4405 | 4256 | return 1; | |
| 4406 | } | ||
| 4407 | |||
| 4408 | 61931 | int32_t new_id = id; | |
| 4409 | 61931 | int32_t effect_type = dmisc15; | |
| 4410 | 61931 | int32_t delay_timer = 90; | |
| 4411 | 61931 | enemy *gleeok = NULL; | |
| 4412 | 61931 | enemy *ptra = NULL; | |
| 4413 | 61931 | int32_t c = 0; | |
| 4414 | |||
| 4415 |
15/29✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 315 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1328 times.
✓ Branch 6 taken 767 times.
✓ Branch 7 taken 21 times.
✓ Branch 8 taken 80 times.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 15 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 182 times.
✓ Branch 13 taken 7845 times.
✓ Branch 14 taken 137 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1789 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 71 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 79 times.
✓ Branch 26 taken 58 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 49243 times.
|
61931 | switch(the_defence) |
| 4416 | { | ||
| 4417 | case edREPLACE: | ||
| 4418 | { | ||
| 4419 | ✗ | sclk = 0; | |
| 4420 | ✗ | if ( dmisc16 > 0 ) new_id = dmisc16; | |
| 4421 | ✗ | else new_id = id+1; | |
| 4422 | ✗ | if ( new_id > 511 ) new_id = id; //Sanity bound to legal enemy IDs. | |
| 4423 | ✗ | if ( dmisc17 > 0 ) delay_timer = dmisc17; | |
| 4424 | //if ( dmisc18 > 0 ) dummy_wpn_id = dmisc18; | ||
| 4425 | |||
| 4426 | //Z_scripterrlog("new id is %d\n", new_id); | ||
| 4427 | ✗ | switch(guysbuf[new_id&0xFFF].family) | |
| 4428 | { | ||
| 4429 | //Fixme: possible enemy memory leak. (minor) | ||
| 4430 | case eeWALK: | ||
| 4431 | { | ||
| 4432 | ✗ | enemy *e = new eStalfos(x,y,new_id,clk); | |
| 4433 | ✗ | guys.add(e); | |
| 4434 | } | ||
| 4435 | ✗ | break; | |
| 4436 | |||
| 4437 | case eeLEV: | ||
| 4438 | { | ||
| 4439 | ✗ | enemy *e = new eLeever(x,y,new_id,clk); | |
| 4440 | ✗ | guys.add(e); | |
| 4441 | } | ||
| 4442 | ✗ | break; | |
| 4443 | |||
| 4444 | case eeTEK: | ||
| 4445 | { | ||
| 4446 | ✗ | enemy *e = new eTektite(x,y,new_id,clk); | |
| 4447 | ✗ | guys.add(e); | |
| 4448 | } | ||
| 4449 | ✗ | break; | |
| 4450 | |||
| 4451 | case eePEAHAT: | ||
| 4452 | { | ||
| 4453 | ✗ | enemy *e = new ePeahat(x,y,new_id,clk); | |
| 4454 | ✗ | guys.add(e); | |
| 4455 | } | ||
| 4456 | ✗ | break; | |
| 4457 | |||
| 4458 | case eeZORA: | ||
| 4459 | { | ||
| 4460 | ✗ | enemy *e = new eZora(x,y,new_id,clk); | |
| 4461 | ✗ | guys.add(e); | |
| 4462 | } | ||
| 4463 | ✗ | break; | |
| 4464 | |||
| 4465 | case eeGHINI: | ||
| 4466 | { | ||
| 4467 | ✗ | enemy *e = new eGhini(x,y,new_id,clk); | |
| 4468 | ✗ | guys.add(e); | |
| 4469 | } | ||
| 4470 | ✗ | break; | |
| 4471 | |||
| 4472 | case eeKEESE: | ||
| 4473 | { | ||
| 4474 | ✗ | enemy *e = new eKeese(x,y,new_id,clk); | |
| 4475 | ✗ | guys.add(e); | |
| 4476 | } | ||
| 4477 | ✗ | break; | |
| 4478 | |||
| 4479 | case eeWIZZ: | ||
| 4480 | { | ||
| 4481 | ✗ | enemy *e = new eWizzrobe(x,y,new_id,clk); | |
| 4482 | ✗ | guys.add(e); | |
| 4483 | } | ||
| 4484 | ✗ | break; | |
| 4485 | |||
| 4486 | case eePROJECTILE: | ||
| 4487 | { | ||
| 4488 | ✗ | enemy *e = new eProjectile(x,y,new_id,clk); | |
| 4489 | ✗ | guys.add(e); | |
| 4490 | } | ||
| 4491 | ✗ | break; | |
| 4492 | |||
| 4493 | case eeWALLM: | ||
| 4494 | { | ||
| 4495 | ✗ | enemy *e = new eWallM(x,y,new_id,clk); | |
| 4496 | ✗ | guys.add(e); | |
| 4497 | } | ||
| 4498 | ✗ | break; | |
| 4499 | |||
| 4500 | case eeAQUA: | ||
| 4501 | { | ||
| 4502 | ✗ | enemy *e = new eAquamentus(x,y,new_id,clk); | |
| 4503 | ✗ | guys.add(e); | |
| 4504 | ✗ | e->x = x; | |
| 4505 | ✗ | e->y = y; | |
| 4506 | } | ||
| 4507 | ✗ | break; | |
| 4508 | |||
| 4509 | case eeMOLD: | ||
| 4510 | { | ||
| 4511 | ✗ | enemy *e = new eMoldorm(x,y,new_id,zc_max(1,zc_min(254,guysbuf[new_id&0xFFF].misc1))); | |
| 4512 | ✗ | guys.add(e); | |
| 4513 | ✗ | e->x = x; | |
| 4514 | ✗ | e->y = y; | |
| 4515 | } | ||
| 4516 | ✗ | break; | |
| 4517 | |||
| 4518 | case eeMANHAN: | ||
| 4519 | { | ||
| 4520 | ✗ | enemy *e = new eManhandla(x,y,new_id,clk); | |
| 4521 | ✗ | guys.add(e); | |
| 4522 | ✗ | e->x = x; | |
| 4523 | ✗ | e->y = y; | |
| 4524 | } | ||
| 4525 | ✗ | break; | |
| 4526 | |||
| 4527 | case eeGLEEOK: | ||
| 4528 | { | ||
| 4529 | ✗ | *power = 0; | |
| 4530 | ✗ | gleeok = new eGleeok(x,y,new_id,guysbuf[new_id&0xFFF].misc1); | |
| 4531 | ✗ | guys.add(gleeok); | |
| 4532 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->hclk = delay_timer; | |
| 4533 | //((enemy*)guys.spr(guys.Count()-1))->stunclk = delay_timer; | ||
| 4534 | ✗ | new_id &= 0xFFF; | |
| 4535 | ✗ | int32_t head_cnt = zc_max(1,zc_min(254,guysbuf[new_id&0xFFF].misc1)); | |
| 4536 | ✗ | Z_scripterrlog("Gleeok head count is %d\n",head_cnt); | |
| 4537 | ✗ | for(int32_t i=0; i<head_cnt; i++) | |
| 4538 | { | ||
| 4539 | //enemy *e = new esGleeok(x,y,new_id+0x1000,clk,gleeok); | ||
| 4540 | ✗ | if(!guys.add(new esGleeok((zfix)x,(zfix)y,new_id+0x1000,c, gleeok))) | |
| 4541 | { | ||
| 4542 | ✗ | al_trace("Gleeok head %d could not be created!\n",i+1); | |
| 4543 | |||
| 4544 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 4545 | { | ||
| 4546 | ✗ | guys.del(guys.Count()-1); | |
| 4547 | ✗ | } | |
| 4548 | |||
| 4549 | ✗ | break; | |
| 4550 | } | ||
| 4551 | else | ||
| 4552 | { | ||
| 4553 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->hclk = delay_timer; | |
| 4554 | //((enemy*)guys.spr(guys.Count()-1))->stunclk = delay_timer; | ||
| 4555 | } | ||
| 4556 | |||
| 4557 | ✗ | c-=guysbuf[new_id].misc4; | |
| 4558 | //gleeok->x = x; | ||
| 4559 | //gleeok->y = y; | ||
| 4560 | //gleeok = e; | ||
| 4561 | ✗ | } | |
| 4562 | ✗ | return 1; | |
| 4563 | } | ||
| 4564 | |||
| 4565 | case eeGHOMA: | ||
| 4566 | { | ||
| 4567 | ✗ | enemy *e = new eGohma(x,y,new_id,clk); | |
| 4568 | ✗ | guys.add(e); | |
| 4569 | ✗ | e->x = x; | |
| 4570 | ✗ | e->y = y; | |
| 4571 | } | ||
| 4572 | ✗ | break; | |
| 4573 | |||
| 4574 | case eeLANM: | ||
| 4575 | { | ||
| 4576 | ✗ | enemy *e = new eLanmola(x,y,new_id,zc_max(1,zc_min(253,guysbuf[new_id&0xFFF].misc1))); | |
| 4577 | ✗ | guys.add(e); | |
| 4578 | ✗ | e->x = x; | |
| 4579 | ✗ | e->y = y; | |
| 4580 | } | ||
| 4581 | ✗ | break; | |
| 4582 | |||
| 4583 | case eeGANON: | ||
| 4584 | { | ||
| 4585 | ✗ | enemy *e = new eGanon(x,y,new_id,clk); | |
| 4586 | ✗ | guys.add(e); | |
| 4587 | ✗ | e->x = x; | |
| 4588 | ✗ | e->y = y; | |
| 4589 | } | ||
| 4590 | ✗ | break; | |
| 4591 | |||
| 4592 | case eeFAIRY: | ||
| 4593 | { | ||
| 4594 | ✗ | enemy *e = new eItemFairy(x,y,new_id+0x1000*clk,clk); | |
| 4595 | ✗ | guys.add(e); | |
| 4596 | ✗ | e->x = x; | |
| 4597 | ✗ | e->y = y; | |
| 4598 | } | ||
| 4599 | ✗ | break; | |
| 4600 | |||
| 4601 | case eeFIRE: | ||
| 4602 | { | ||
| 4603 | ✗ | enemy *e = new eFire(x,y,new_id,clk); | |
| 4604 | ✗ | guys.add(e); | |
| 4605 | ✗ | e->x = x; | |
| 4606 | ✗ | e->y = y; | |
| 4607 | } | ||
| 4608 | ✗ | break; | |
| 4609 | |||
| 4610 | case eeOTHER: | ||
| 4611 | { | ||
| 4612 | ✗ | enemy *e = new eOther(x,y,new_id,clk); | |
| 4613 | ✗ | guys.add(e); | |
| 4614 | ✗ | e->x = x; | |
| 4615 | ✗ | e->y = y; | |
| 4616 | } | ||
| 4617 | ✗ | break; | |
| 4618 | |||
| 4619 | case eeSPINTILE: | ||
| 4620 | { | ||
| 4621 | ✗ | enemy *e = new eSpinTile(x,y,new_id,clk); | |
| 4622 | ✗ | guys.add(e); | |
| 4623 | ✗ | e->x = x; | |
| 4624 | ✗ | e->y = y; | |
| 4625 | } | ||
| 4626 | ✗ | break; | |
| 4627 | |||
| 4628 | // and these enemies use the misc10/misc2 value | ||
| 4629 | case eeROCK: | ||
| 4630 | { | ||
| 4631 | ✗ | switch(guysbuf[new_id&0xFFF].misc10) | |
| 4632 | { | ||
| 4633 | case 1: | ||
| 4634 | { | ||
| 4635 | ✗ | enemy *e = new eBoulder(x,y,new_id,clk); | |
| 4636 | ✗ | guys.add(e); | |
| 4637 | ✗ | e->x = x; | |
| 4638 | ✗ | e->y = y; | |
| 4639 | } | ||
| 4640 | ✗ | break; | |
| 4641 | |||
| 4642 | ✗ | case 0: | |
| 4643 | default: | ||
| 4644 | { | ||
| 4645 | ✗ | enemy *e = new eRock(x,y,new_id,clk); | |
| 4646 | ✗ | guys.add(e); | |
| 4647 | ✗ | e->x = x; | |
| 4648 | ✗ | e->y = y; | |
| 4649 | } | ||
| 4650 | ✗ | break; | |
| 4651 | } | ||
| 4652 | |||
| 4653 | ✗ | break; | |
| 4654 | } | ||
| 4655 | |||
| 4656 | case eeTRAP: | ||
| 4657 | { | ||
| 4658 | ✗ | switch(guysbuf[new_id&0xFFF].misc2) | |
| 4659 | { | ||
| 4660 | case 1: | ||
| 4661 | { | ||
| 4662 | ✗ | enemy *e = new eTrap2(x,y,new_id,clk); | |
| 4663 | ✗ | guys.add(e); | |
| 4664 | ✗ | e->x = x; | |
| 4665 | ✗ | e->y = y; | |
| 4666 | } | ||
| 4667 | ✗ | break; | |
| 4668 | |||
| 4669 | ✗ | case 0: | |
| 4670 | default: | ||
| 4671 | { | ||
| 4672 | ✗ | enemy *e = new eTrap(x,y,new_id,clk); | |
| 4673 | ✗ | guys.add(e); | |
| 4674 | ✗ | e->x = x; | |
| 4675 | ✗ | e->y = y; | |
| 4676 | } | ||
| 4677 | ✗ | break; | |
| 4678 | } | ||
| 4679 | |||
| 4680 | ✗ | break; | |
| 4681 | } | ||
| 4682 | |||
| 4683 | case eeDONGO: | ||
| 4684 | { | ||
| 4685 | ✗ | switch(guysbuf[new_id&0xFFF].misc10) | |
| 4686 | { | ||
| 4687 | case 1: | ||
| 4688 | { | ||
| 4689 | ✗ | enemy *e = new eDodongo2(x,y,new_id,clk); | |
| 4690 | ✗ | guys.add(e); | |
| 4691 | ✗ | e->x = x; | |
| 4692 | ✗ | e->y = y; | |
| 4693 | } | ||
| 4694 | ✗ | break; | |
| 4695 | |||
| 4696 | ✗ | case 0: | |
| 4697 | default: | ||
| 4698 | { | ||
| 4699 | ✗ | enemy *e = new eDodongo(x,y,new_id,clk); | |
| 4700 | ✗ | guys.add(e); | |
| 4701 | ✗ | e->x = x; | |
| 4702 | ✗ | e->y = y; | |
| 4703 | } | ||
| 4704 | ✗ | break; | |
| 4705 | } | ||
| 4706 | |||
| 4707 | ✗ | break; | |
| 4708 | } | ||
| 4709 | |||
| 4710 | case eeDIG: | ||
| 4711 | { | ||
| 4712 | ✗ | switch(guysbuf[new_id&0xFFF].misc10) | |
| 4713 | { | ||
| 4714 | case 1: | ||
| 4715 | { | ||
| 4716 | ✗ | enemy *e = new eLilDig(x,y,new_id,clk); | |
| 4717 | ✗ | guys.add(e); | |
| 4718 | ✗ | e->x = x; | |
| 4719 | ✗ | e->y = y; | |
| 4720 | } | ||
| 4721 | ✗ | break; | |
| 4722 | |||
| 4723 | ✗ | case 0: | |
| 4724 | default: | ||
| 4725 | { | ||
| 4726 | ✗ | enemy *e = new eBigDig(x,y,new_id,clk); | |
| 4727 | ✗ | guys.add(e); | |
| 4728 | ✗ | e->x = x; | |
| 4729 | ✗ | e->y = y; | |
| 4730 | } | ||
| 4731 | ✗ | break; | |
| 4732 | } | ||
| 4733 | |||
| 4734 | ✗ | break; | |
| 4735 | } | ||
| 4736 | |||
| 4737 | case eePATRA: | ||
| 4738 | { | ||
| 4739 | ✗ | switch(guysbuf[new_id&0xFFF].misc10) | |
| 4740 | { | ||
| 4741 | case 1: | ||
| 4742 | { | ||
| 4743 | ✗ | if (get_bit(quest_rules,qr_HARDCODED_BS_PATRA)) | |
| 4744 | { | ||
| 4745 | ✗ | enemy *e = new ePatraBS(x,y,new_id,clk); | |
| 4746 | ✗ | guys.add(e); | |
| 4747 | ✗ | e->x = x; | |
| 4748 | ✗ | e->y = y; | |
| 4749 | ✗ | break; | |
| 4750 | } | ||
| 4751 | ✗ | } | |
| 4752 | [[fallthrough]]; | ||
| 4753 | ✗ | case 0: | |
| 4754 | default: | ||
| 4755 | { | ||
| 4756 | ✗ | enemy *e = new ePatra(x,y,new_id,clk); | |
| 4757 | ✗ | guys.add(e); | |
| 4758 | ✗ | e->x = x; | |
| 4759 | ✗ | e->y = y; | |
| 4760 | } | ||
| 4761 | ✗ | break; | |
| 4762 | } | ||
| 4763 | |||
| 4764 | ✗ | break; | |
| 4765 | } | ||
| 4766 | |||
| 4767 | case eeGUY: | ||
| 4768 | { | ||
| 4769 | ✗ | switch(guysbuf[new_id&0xFFF].misc10) | |
| 4770 | { | ||
| 4771 | case 1: | ||
| 4772 | { | ||
| 4773 | ✗ | enemy *e = new eTrigger(x,y,new_id,clk); | |
| 4774 | ✗ | guys.add(e); | |
| 4775 | } | ||
| 4776 | ✗ | break; | |
| 4777 | |||
| 4778 | ✗ | case 0: | |
| 4779 | default: | ||
| 4780 | { | ||
| 4781 | ✗ | enemy *e = new eNPC(x,y,new_id,clk); | |
| 4782 | ✗ | guys.add(e); | |
| 4783 | } | ||
| 4784 | ✗ | break; | |
| 4785 | } | ||
| 4786 | |||
| 4787 | ✗ | break; | |
| 4788 | } | ||
| 4789 | |||
| 4790 | case eeSCRIPT01: | ||
| 4791 | case eeSCRIPT02: | ||
| 4792 | case eeSCRIPT03: | ||
| 4793 | case eeSCRIPT04: | ||
| 4794 | case eeSCRIPT05: | ||
| 4795 | case eeSCRIPT06: | ||
| 4796 | case eeSCRIPT07: | ||
| 4797 | case eeSCRIPT08: | ||
| 4798 | case eeSCRIPT09: | ||
| 4799 | case eeSCRIPT10: | ||
| 4800 | case eeSCRIPT11: | ||
| 4801 | case eeSCRIPT12: | ||
| 4802 | case eeSCRIPT13: | ||
| 4803 | case eeSCRIPT14: | ||
| 4804 | case eeSCRIPT15: | ||
| 4805 | case eeSCRIPT16: | ||
| 4806 | case eeSCRIPT17: | ||
| 4807 | case eeSCRIPT18: | ||
| 4808 | case eeSCRIPT19: | ||
| 4809 | case eeSCRIPT20: | ||
| 4810 | { | ||
| 4811 | ✗ | enemy *e = new eScript(x,y,new_id,clk); | |
| 4812 | ✗ | guys.add(e); | |
| 4813 | ✗ | e->x = x; | |
| 4814 | ✗ | e->y = y; | |
| 4815 | ✗ | break; | |
| 4816 | } | ||
| 4817 | |||
| 4818 | |||
| 4819 | case eeFFRIENDLY01: | ||
| 4820 | case eeFFRIENDLY02: | ||
| 4821 | case eeFFRIENDLY03: | ||
| 4822 | case eeFFRIENDLY04: | ||
| 4823 | case eeFFRIENDLY05: | ||
| 4824 | case eeFFRIENDLY06: | ||
| 4825 | case eeFFRIENDLY07: | ||
| 4826 | case eeFFRIENDLY08: | ||
| 4827 | case eeFFRIENDLY09: | ||
| 4828 | case eeFFRIENDLY10: | ||
| 4829 | { | ||
| 4830 | ✗ | enemy *e = new eFriendly(x,y,new_id,clk); | |
| 4831 | ✗ | guys.add(e); | |
| 4832 | ✗ | e->x = x; | |
| 4833 | ✗ | e->y = y; | |
| 4834 | ✗ | break; | |
| 4835 | } | ||
| 4836 | |||
| 4837 | |||
| 4838 | ✗ | default: break; | |
| 4839 | } | ||
| 4840 | |||
| 4841 | // add segments of segmented enemies | ||
| 4842 | ✗ | int32_t c=0; | |
| 4843 | |||
| 4844 | ✗ | switch(guysbuf[new_id&0xFFF].family) | |
| 4845 | { | ||
| 4846 | case eeMOLD: | ||
| 4847 | { | ||
| 4848 | ✗ | byte is=((enemy*)guys.spr(guys.Count()-1))->item_set; | |
| 4849 | ✗ | new_id &= 0xFFF; | |
| 4850 | |||
| 4851 | ✗ | for(int32_t i=0; i<zc_max(1,zc_min(254,guysbuf[new_id].misc1)); i++) | |
| 4852 | { | ||
| 4853 | //christ this is messy -DD | ||
| 4854 | ✗ | int32_t segclk = -i*((int32_t)(8.0/(zslongToFix(guysbuf[new_id&0xFFF].step*100)))); | |
| 4855 | |||
| 4856 | ✗ | if(!guys.add(new esMoldorm((zfix)x,(zfix)y,new_id+0x1000,segclk))) | |
| 4857 | { | ||
| 4858 | ✗ | al_trace("Moldorm segment %d could not be created!\n",i+1); | |
| 4859 | |||
| 4860 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 4861 | ✗ | guys.del(guys.Count()-1); | |
| 4862 | |||
| 4863 | ✗ | return 0; | |
| 4864 | } | ||
| 4865 | |||
| 4866 | ✗ | if(i>0) | |
| 4867 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->item_set=is; | |
| 4868 | |||
| 4869 | |||
| 4870 | ✗ | } | |
| 4871 | |||
| 4872 | ✗ | break; | |
| 4873 | } | ||
| 4874 | |||
| 4875 | case eeLANM: | ||
| 4876 | { | ||
| 4877 | ✗ | new_id &= 0xFFF; | |
| 4878 | ✗ | int32_t shft = guysbuf[new_id].misc2; | |
| 4879 | ✗ | byte is=((enemy*)guys.spr(guys.Count()-1))->item_set; | |
| 4880 | ✗ | enemy *e = new esLanmola((zfix)x,(zfix)y,new_id+0x1000,0); | |
| 4881 | |||
| 4882 | ✗ | if(!guys.add(e)) | |
| 4883 | { | ||
| 4884 | ✗ | al_trace("Lanmola segment 1 could not be created!\n"); | |
| 4885 | ✗ | guys.del(guys.Count()-1); | |
| 4886 | ✗ | return 0; | |
| 4887 | } | ||
| 4888 | ✗ | e->x = x; | |
| 4889 | ✗ | e->y = y; | |
| 4890 | |||
| 4891 | |||
| 4892 | |||
| 4893 | ✗ | for(int32_t i=1; i<zc_max(1,zc_min(253,guysbuf[new_id&0xFFF].misc1)); i++) | |
| 4894 | { | ||
| 4895 | ✗ | enemy *e2 = new esLanmola((zfix)x,(zfix)y,new_id+0x2000,-(i<<shft)); | |
| 4896 | ✗ | if(!guys.add(e2)) | |
| 4897 | { | ||
| 4898 | ✗ | al_trace("Lanmola segment %d could not be created!\n",i+1); | |
| 4899 | |||
| 4900 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 4901 | ✗ | guys.del(guys.Count()-1); | |
| 4902 | |||
| 4903 | ✗ | return 0; | |
| 4904 | } | ||
| 4905 | ✗ | e2->x = x; | |
| 4906 | ✗ | e2->y = y; | |
| 4907 | |||
| 4908 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->item_set=is; | |
| 4909 | |||
| 4910 | ✗ | } | |
| 4911 | } | ||
| 4912 | ✗ | break; | |
| 4913 | |||
| 4914 | case eeMANHAN: | ||
| 4915 | ✗ | new_id &= 0xFFF; | |
| 4916 | |||
| 4917 | ✗ | for(int32_t i=0; i<((!(guysbuf[new_id].misc2))?4:8); i++) | |
| 4918 | { | ||
| 4919 | ✗ | if(!guys.add(new esManhandla((zfix)x,(zfix)y,new_id+0x1000,i))) | |
| 4920 | { | ||
| 4921 | ✗ | al_trace("Manhandla head %d could not be created!\n",i+1); | |
| 4922 | |||
| 4923 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 4924 | { | ||
| 4925 | ✗ | guys.del(guys.Count()-1); | |
| 4926 | ✗ | } | |
| 4927 | |||
| 4928 | ✗ | return 0; | |
| 4929 | } | ||
| 4930 | |||
| 4931 | |||
| 4932 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->frate=guysbuf[new_id].misc1; | |
| 4933 | ✗ | } | |
| 4934 | |||
| 4935 | ✗ | break; | |
| 4936 | |||
| 4937 | case eeGLEEOK: | ||
| 4938 | { | ||
| 4939 | /* | ||
| 4940 | new_id &= 0xFFF; | ||
| 4941 | int32_t head_cnt = zc_max(1,zc_min(254,guysbuf[new_id&0xFFF].misc1)); | ||
| 4942 | Z_scripterrlog("Gleeok head count is %d\n",head_cnt); | ||
| 4943 | for(int32_t i=0; i<head_cnt; i++) | ||
| 4944 | { | ||
| 4945 | //enemy *e = new esGleeok(x,y,new_id+0x1000,clk,gleeok); | ||
| 4946 | if(!guys.add(new esGleeok((zfix)x,(zfix)y,new_id+0x1000,c, gleeok))) | ||
| 4947 | { | ||
| 4948 | al_trace("Gleeok head %d could not be created!\n",i+1); | ||
| 4949 | |||
| 4950 | for(int32_t j=0; j<i+1; j++) | ||
| 4951 | { | ||
| 4952 | guys.del(guys.Count()-1); | ||
| 4953 | } | ||
| 4954 | |||
| 4955 | break; | ||
| 4956 | } | ||
| 4957 | |||
| 4958 | c-=guysbuf[new_id].misc4; | ||
| 4959 | */ | ||
| 4960 | |||
| 4961 | // } | ||
| 4962 | } | ||
| 4963 | ✗ | break; | |
| 4964 | |||
| 4965 | |||
| 4966 | case eePATRA: | ||
| 4967 | { | ||
| 4968 | ✗ | new_id &= 0xFFF; | |
| 4969 | ✗ | int32_t outeyes = 0; | |
| 4970 | ✗ | ptra = new ePatraBS((zfix)x,(zfix)y,id,clk); | |
| 4971 | |||
| 4972 | ✗ | for(int32_t i=0; i<zc_min(254,guysbuf[new_id&0xFFF].misc1); i++) | |
| 4973 | { | ||
| 4974 | ✗ | if(!((guysbuf[new_id].misc10&&get_bit(quest_rules,qr_HARDCODED_BS_PATRA))?guys.add(new esPatraBS((zfix)x,(zfix)y,new_id+0x1000,i,ptra)):guys.add(new esPatra((zfix)x,(zfix)y,new_id+0x1000,i,ptra)))) | |
| 4975 | { | ||
| 4976 | ✗ | al_trace("Patra outer eye %d could not be created!\n",i+1); | |
| 4977 | |||
| 4978 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 4979 | ✗ | guys.del(guys.Count()-1); | |
| 4980 | |||
| 4981 | ✗ | return 0; | |
| 4982 | } | ||
| 4983 | else | ||
| 4984 | ✗ | outeyes++; | |
| 4985 | |||
| 4986 | |||
| 4987 | ✗ | } | |
| 4988 | |||
| 4989 | ✗ | for(int32_t i=0; i<zc_min(254,guysbuf[new_id&0xFFF].misc2); i++) | |
| 4990 | { | ||
| 4991 | ✗ | if(!guys.add(new esPatra((zfix)x,(zfix)y,new_id+0x1000,i,ptra))) | |
| 4992 | { | ||
| 4993 | ✗ | al_trace("Patra inner eye %d could not be created!\n",i+1); | |
| 4994 | |||
| 4995 | ✗ | for(int32_t j=0; j<i+1+zc_min(254,outeyes); j++) | |
| 4996 | ✗ | guys.del(guys.Count()-1); | |
| 4997 | |||
| 4998 | ✗ | return 0; | |
| 4999 | } | ||
| 5000 | |||
| 5001 | |||
| 5002 | ✗ | } | |
| 5003 | ✗ | delete ptra; | |
| 5004 | ✗ | break; | |
| 5005 | } | ||
| 5006 | } | ||
| 5007 | |||
| 5008 | |||
| 5009 | |||
| 5010 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->count_enemy = true; | |
| 5011 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->stunclk = delay_timer; | |
| 5012 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->dir = this->dir; | |
| 5013 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->scale = this->scale; | |
| 5014 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->angular = this->angular; | |
| 5015 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->angle = this->angle; | |
| 5016 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->rotation = this->rotation; | |
| 5017 | //((enemy*)guys.spr(guys.Count()-1))->mainguy = this->mainguy; //This might mean that it is a core. | ||
| 5018 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->itemguy = this->itemguy; | |
| 5019 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->leader = this->leader; | |
| 5020 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->hclk = delay_timer; | |
| 5021 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->script_spawned = this->script_spawned; | |
| 5022 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->script_UID = this->script_UID; | |
| 5023 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->sclk = 0; | |
| 5024 | |||
| 5025 | |||
| 5026 | ✗ | item_set = 0; //Do not make a drop. | |
| 5027 | |||
| 5028 | ✗ | switch(effect_type) | |
| 5029 | { | ||
| 5030 | case -7: | ||
| 5031 | { | ||
| 5032 | ✗ | weapon *w = new weapon(x,y-fakez,z,wBomb,0,wdp,0,-1,getUID(),false, 0); | |
| 5033 | ✗ | Lwpns.add(w); | |
| 5034 | ✗ | break; | |
| 5035 | } | ||
| 5036 | case -6: | ||
| 5037 | { | ||
| 5038 | ✗ | weapon *w = new weapon(x,y-fakez,z,wSBomb,0,wdp,0,-1,getUID(),false, 0); | |
| 5039 | ✗ | Lwpns.add(w); | |
| 5040 | ✗ | break; | |
| 5041 | } | ||
| 5042 | case -5: | ||
| 5043 | { | ||
| 5044 | ✗ | weapon *w = new weapon(x,y-fakez,z,wBomb,effect_type,0,0,Hero.getUID(), txsz, tysz); | |
| 5045 | ✗ | Lwpns.add(w); | |
| 5046 | ✗ | break; | |
| 5047 | } | ||
| 5048 | case -4: | ||
| 5049 | { | ||
| 5050 | ✗ | weapon *w = new weapon(x,y-fakez,z,wSBomb,effect_type,0,0,Hero.getUID(), txsz, tysz); | |
| 5051 | ✗ | Lwpns.add(w); | |
| 5052 | ✗ | break; | |
| 5053 | } | ||
| 5054 | ✗ | case -3: explode(1); break; | |
| 5055 | ✗ | case -2: explode(2); break; | |
| 5056 | ✗ | case -1: explode(0); break; | |
| 5057 | ✗ | case 0: break; | |
| 5058 | |||
| 5059 | default: | ||
| 5060 | { | ||
| 5061 | //Dummy weapon function | ||
| 5062 | ✗ | if ( effect_type > 255 ) effect_type = 0; //Sanity bound the sprite ID. | |
| 5063 | ✗ | weapon *w = new weapon(x,y-fakez,z,wSSparkle,effect_type,0,0,Hero.getUID(), txsz, tysz,0,0,0,0,0,0,0); | |
| 5064 | ✗ | Lwpns.add(w); | |
| 5065 | ✗ | break; | |
| 5066 | } | ||
| 5067 | } | ||
| 5068 | |||
| 5069 | |||
| 5070 | ✗ | yofs = -32768; | |
| 5071 | ✗ | switch(guysbuf[new_id&0xFFF].family) | |
| 5072 | { | ||
| 5073 | case eeGLEEOK: | ||
| 5074 | { | ||
| 5075 | ✗ | Z_scripterrlog("Replacing a gleeok.\n"); | |
| 5076 | ✗ | enemy *tempenemy = (enemy *) guys.getByUID(parentCore); | |
| 5077 | ✗ | hp = -999; | |
| 5078 | ✗ | tempenemy->hp = -999; | |
| 5079 | ✗ | break; | |
| 5080 | |||
| 5081 | } | ||
| 5082 | default: | ||
| 5083 | ✗ | hp = -1000; break; | |
| 5084 | } | ||
| 5085 | ✗ | ++game->guys[(currmap*MAPSCRSNORMAL)+currscr]; | |
| 5086 | ✗ | return 1; | |
| 5087 | |||
| 5088 | } | ||
| 5089 | case edSPLIT: | ||
| 5090 | { | ||
| 5091 | //int32_t ex = x; int32_t ey = y; | ||
| 5092 | //al_trace("edSplit dmisc3: %d\n", dmisc3); | ||
| 5093 | //al_trace("edSplit dmisc4: %d\n", dmisc4); | ||
| 5094 | /* | ||
| 5095 | if ( txsx > 1 ) | ||
| 5096 | { | ||
| 5097 | ex += ( txsz-1 ) * 8; //from its middle | ||
| 5098 | } | ||
| 5099 | if ( tysx > 1 ) | ||
| 5100 | { | ||
| 5101 | ey += ( tysz-1 ) * 8; //from its middle | ||
| 5102 | } | ||
| 5103 | */ | ||
| 5104 | ✗ | for ( int32_t q = 0; q < dmisc4; q++ ) | |
| 5105 | { | ||
| 5106 | |||
| 5107 | //addenemy((x+(txsz*16)/2),(y+(tysz*16)/2),dmisc3+0x1000,-15); | ||
| 5108 | ✗ | addenemy( | |
| 5109 | //ex,ey, | ||
| 5110 | ✗ | x,y, | |
| 5111 | ✗ | dmisc3+0x1000,-15); | |
| 5112 | //addenemy(ex,ey,dmisc3,0); | ||
| 5113 | |||
| 5114 | ✗ | } | |
| 5115 | ✗ | item_set = 0; //Do not make a drop. | |
| 5116 | ✗ | hp = -1000; | |
| 5117 | ✗ | return -1; | |
| 5118 | |||
| 5119 | } | ||
| 5120 | case edSUMMON: | ||
| 5121 | { | ||
| 5122 | |||
| 5123 | |||
| 5124 | //al_trace("edSplit dmisc3: %d\n", dmisc3); | ||
| 5125 | //al_trace("edSplit dmisc4: %d\n", dmisc4); | ||
| 5126 | ✗ | int32_t summon_count = (zc_oldrand()%dmisc4)+1; | |
| 5127 | ✗ | for ( int32_t q = 0; q < summon_count; q++ ) | |
| 5128 | { | ||
| 5129 | ✗ | int32_t x2=16*((zc_oldrand()%12)+2); | |
| 5130 | ✗ | int32_t y2=16*((zc_oldrand()%7)+2); | |
| 5131 | ✗ | addenemy( | |
| 5132 | //(x+(txsz*16)/2),(y+(tysz*16)/2) | ||
| 5133 | ✗ | x2,y2, | |
| 5134 | ✗ | dmisc3+0x1000,-15); | |
| 5135 | //addenemy(ex,ey,dmisc3,0); | ||
| 5136 | |||
| 5137 | ✗ | } | |
| 5138 | ✗ | sfx(get_bit(quest_rules,qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE,pan(int32_t(x))); | |
| 5139 | ✗ | return -1; | |
| 5140 | |||
| 5141 | } | ||
| 5142 | |||
| 5143 | case edEXPLODESMALL: | ||
| 5144 | { | ||
| 5145 | ✗ | weapon *ew=new weapon(x,y-fakez,z, ewBomb, 0, dmisc4, dir,-1,getUID(),false); | |
| 5146 | ✗ | Ewpns.add(ew); | |
| 5147 | ✗ | item_set = 0; //Should we make a drop? | |
| 5148 | ✗ | hp = -1000; | |
| 5149 | ✗ | return -1; | |
| 5150 | } | ||
| 5151 | |||
| 5152 | |||
| 5153 | case edEXPLODEHARMLESS: | ||
| 5154 | { | ||
| 5155 | ✗ | weapon *ew=new weapon(x,y-fakez,z, ewSBomb, 0, dmisc4, dir,-1,getUID(),false); | |
| 5156 | ✗ | Ewpns.add(ew); | |
| 5157 | ✗ | ew->hyofs = -32768; | |
| 5158 | ✗ | item_set = 0; //Should we make a drop? | |
| 5159 | ✗ | hp = -1000; | |
| 5160 | ✗ | return -1; | |
| 5161 | } | ||
| 5162 | |||
| 5163 | |||
| 5164 | case edEXPLODELARGE: | ||
| 5165 | { | ||
| 5166 | ✗ | weapon *ew=new weapon(x,y-fakez,z, ewSBomb, 0, dmisc4, dir,-1,getUID(),false); | |
| 5167 | ✗ | Ewpns.add(ew); | |
| 5168 | |||
| 5169 | ✗ | hp = -1000; | |
| 5170 | ✗ | return -1; | |
| 5171 | } | ||
| 5172 | |||
| 5173 | |||
| 5174 | case edTRIGGERSECRETS: | ||
| 5175 | { | ||
| 5176 | ✗ | hidden_entrance(0, true, false, -4); | |
| 5177 | ✗ | return -1; | |
| 5178 | } | ||
| 5179 | |||
| 5180 | case edSTUNORCHINK: | ||
| 5181 |
3/4✓ Branch 0 taken 948 times.
✓ Branch 1 taken 841 times.
✓ Branch 2 taken 948 times.
✗ Branch 3 not taken.
|
3067 | if (stunclk && get_bit(quest_rules, qr_NO_STUNLOCK)) |
| 5182 | { | ||
| 5183 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5184 | ✗ | return 1; | |
| 5185 | } | ||
| 5186 |
2/2✓ Branch 0 taken 511 times.
✓ Branch 1 taken 1278 times.
|
1789 | else if(*power <= 0) |
| 5187 | { | ||
| 5188 | //al_trace("defendNew() is at: %s\n", "returning edSTUNORCHINK"); | ||
| 5189 | 511 | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5190 | 511 | return 1; | |
| 5191 | } | ||
| 5192 | [[fallthrough]]; | ||
| 5193 | |||
| 5194 | case edSTUNORIGNORE: | ||
| 5195 |
3/4✓ Branch 0 taken 1438 times.
✓ Branch 1 taken 1168 times.
✓ Branch 2 taken 1438 times.
✗ Branch 3 not taken.
|
4493 | if (stunclk && get_bit(quest_rules, qr_NO_STUNLOCK)) |
| 5196 | { | ||
| 5197 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5198 | ✗ | return 1; | |
| 5199 | } | ||
| 5200 |
2/2✓ Branch 0 taken 719 times.
✓ Branch 1 taken 1887 times.
|
2606 | else if(*power <= 0) |
| 5201 | 719 | return 0; | |
| 5202 | [[fallthrough]]; | ||
| 5203 | |||
| 5204 | case edSTUNONLY: | ||
| 5205 |
7/10✓ Branch 0 taken 2654 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2654 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2654 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2598 times.
✓ Branch 7 taken 56 times.
✓ Branch 8 taken 2625 times.
✓ Branch 9 taken 29 times.
|
2654 | if((wpnId==wFire || wpnId==wBomb || wpnId==wSBomb || wpnId==wHookshot || wpnId==wSword) && stunclk>=159) |
| 5206 | { | ||
| 5207 | //al_trace("enemy::defend(), edSTUNONLY found a weapon of type FIRE, BOMB, SBOMB, HOOKSHOT, or SWORD:, with wpnId: \n", wpnId); | ||
| 5208 | // Z_message("enemy::defend(), edSTUNONLY found a weapon of type FIRE, BOMB, SBOMB, HOOKSHOT, or SWORD:, with wpnId: \n", wpnId); | ||
| 5209 | 29 | return 1; | |
| 5210 | } | ||
| 5211 |
3/4✓ Branch 0 taken 2006 times.
✓ Branch 1 taken 619 times.
✓ Branch 2 taken 2006 times.
✗ Branch 3 not taken.
|
2625 | if (stunclk && get_bit(quest_rules, qr_NO_STUNLOCK)) |
| 5212 | { | ||
| 5213 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5214 | ✗ | return 1; | |
| 5215 | } | ||
| 5216 | else | ||
| 5217 | { | ||
| 5218 | 2625 | stunclk=160; | |
| 5219 | 2625 | sfx(WAV_EHIT,pan(int32_t(x))); | |
| 5220 | |||
| 5221 | 2625 | return 1; | |
| 5222 | } | ||
| 5223 | |||
| 5224 | case edCHINKL1: | ||
| 5225 | ✗ | if(*power >= 1*game->get_hero_dmgmult()) break; | |
| 5226 | [[fallthrough]]; | ||
| 5227 | case edCHINKL2: | ||
| 5228 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if(*power >= 2*game->get_hero_dmgmult()) break; |
| 5229 | [[fallthrough]]; | ||
| 5230 | case edCHINKL4: | ||
| 5231 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 19 times.
|
80 | if(*power >= 4*game->get_hero_dmgmult()) break; |
| 5232 | [[fallthrough]]; | ||
| 5233 | case edCHINKL6: | ||
| 5234 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if(*power >= 6*game->get_hero_dmgmult()) break; |
| 5235 | [[fallthrough]]; | ||
| 5236 | case edCHINKL8: | ||
| 5237 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 20 times.
|
35 | if(*power >= 8*game->get_hero_dmgmult()) break; |
| 5238 | [[fallthrough]]; | ||
| 5239 | case edCHINKL10: | ||
| 5240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if(*power >= 10*game->get_hero_dmgmult()) break; |
| 5241 | [[fallthrough]]; | ||
| 5242 | case edCHINK: | ||
| 5243 | //al_trace("defendNew() is at: %s\n", "returning edCHINK"); | ||
| 5244 | 202 | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5245 | 202 | return 1; | |
| 5246 | |||
| 5247 | case edIGNOREL1: | ||
| 5248 | ✗ | if(*power > 0) break; | |
| 5249 | [[fallthrough]]; | ||
| 5250 | |||
| 5251 | case edIGNORE: | ||
| 5252 | 7845 | return 0; | |
| 5253 | |||
| 5254 | case ed1HKO: | ||
| 5255 | 315 | *power = hp; | |
| 5256 | 315 | return -2; | |
| 5257 | |||
| 5258 | case ed2x: | ||
| 5259 | { | ||
| 5260 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71 times.
|
71 | *power = zc_max(1,*power*2); |
| 5261 | //int32_t pow = *power; | ||
| 5262 | //*power = vbound((pow*2),0,214747); | ||
| 5263 | 71 | return -1; | |
| 5264 | } | ||
| 5265 | case ed3x: | ||
| 5266 | { | ||
| 5267 | ✗ | *power = zc_max(1,*power*3); | |
| 5268 | //int32_t pow = *power; | ||
| 5269 | //*power = vbound((pow*3),0,214747); | ||
| 5270 | ✗ | return -1; | |
| 5271 | } | ||
| 5272 | |||
| 5273 | case ed4x: | ||
| 5274 | { | ||
| 5275 | ✗ | *power = zc_max(1,*power*4); | |
| 5276 | //int32_t pow = *power; | ||
| 5277 | //*power = vbound((pow*4),0,214747); | ||
| 5278 | ✗ | return -1; | |
| 5279 | } | ||
| 5280 | |||
| 5281 | |||
| 5282 | case edHEAL: | ||
| 5283 | { //Probably needs its own function, or routine in the damage functuon to heal if power is negative. | ||
| 5284 | //int32_t pow = *power; | ||
| 5285 | //*power = vbound((pow*-1),0,214747); | ||
| 5286 | //break; | ||
| 5287 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
|
79 | *power = zc_min(0,*power*-1); |
| 5288 | 79 | return -1; | |
| 5289 | } | ||
| 5290 | /* | ||
| 5291 | case edLEVELDAMAGE: | ||
| 5292 | { | ||
| 5293 | int32_t pow = *power; | ||
| 5294 | int32_t lvl = *level; | ||
| 5295 | *power = vbound((pow*lvl),0,214747); | ||
| 5296 | break; | ||
| 5297 | } | ||
| 5298 | case edLEVELREDUCTION: | ||
| 5299 | { | ||
| 5300 | int32_t pow = *power; | ||
| 5301 | int32_t lvl = *level; | ||
| 5302 | *power = vbound((pow/lvl),0,214747); | ||
| 5303 | break; | ||
| 5304 | } | ||
| 5305 | */ | ||
| 5306 | |||
| 5307 | case edQUARTDAMAGE: | ||
| 5308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
|
58 | *power = zc_max(1,*power/2); |
| 5309 | |||
| 5310 | [[fallthrough]]; | ||
| 5311 | case edHALFDAMAGE: | ||
| 5312 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 194 times.
|
195 | *power = zc_max(1,*power/2); |
| 5313 | 195 | break; | |
| 5314 | |||
| 5315 | case edSWITCH: | ||
| 5316 | { | ||
| 5317 | ✗ | if(Hero.switchhookclk) return 0; //Already switching! | |
| 5318 | ✗ | switch(family) | |
| 5319 | { | ||
| 5320 | case eeAQUA: case eeMOLD: case eeDONGO: case eeMANHAN: case eeGLEEOK: | ||
| 5321 | case eeDIG: case eeGHOMA: case eeLANM: case eePATRA: case eeGANON: | ||
| 5322 | ✗ | return 0; | |
| 5323 | } | ||
| 5324 | ✗ | hooked_combopos = -1; | |
| 5325 | ✗ | hooked_layerbits = 0; | |
| 5326 | ✗ | switching_object = this; | |
| 5327 | ✗ | switch_hooked = true; | |
| 5328 | ✗ | Hero.doSwitchHook(game->get_switchhookstyle()); | |
| 5329 | ✗ | if(QMisc.miscsfx[sfxSWITCHED]) | |
| 5330 | ✗ | sfx(QMisc.miscsfx[sfxSWITCHED],int32_t(x)); | |
| 5331 | ✗ | return 1; | |
| 5332 | } | ||
| 5333 | |||
| 5334 | case 0: | ||
| 5335 | { | ||
| 5336 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 49243 times.
|
49243 | if(edef == edefSwitchHook) |
| 5337 | ✗ | return -1; | |
| 5338 |
6/6✓ Branch 0 taken 12302 times.
✓ Branch 1 taken 36941 times.
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 12273 times.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 13 times.
|
49243 | if (stunclk && get_bit(quest_rules, qr_NO_STUNLOCK) && *power == 0) |
| 5339 | { | ||
| 5340 | 13 | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5341 | 13 | return 1; | |
| 5342 | } | ||
| 5343 | |||
| 5344 | } | ||
| 5345 | 49230 | } | |
| 5346 | |||
| 5347 | 49522 | return -1; | |
| 5348 | 66188 | } | |
| 5349 | |||
| 5350 | 66188 | int32_t enemy::defendNewInt(int32_t wpnId, int32_t *power, int32_t edef, byte unblockable, weapon* w) | |
| 5351 | { | ||
| 5352 |
1/2✓ Branch 0 taken 66188 times.
✗ Branch 1 not taken.
|
66188 | int wuid = w?w->getUID():0; |
| 5353 |
1/2✓ Branch 0 taken 66188 times.
✗ Branch 1 not taken.
|
66188 | bool fakeweap = (w && !Lwpns.getByUID(wuid)); |
| 5354 | |||
| 5355 |
1/2✓ Branch 0 taken 66188 times.
✗ Branch 1 not taken.
|
66188 | if(fakeweap) |
| 5356 | ✗ | Lwpns.add(w); | |
| 5357 | 66188 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 5358 | 66188 | ev.clear(); | |
| 5359 | 66188 | ev.push_back(*power*10000); | |
| 5360 | 66188 | ev.push_back(edef*10000); | |
| 5361 | 66188 | ev.push_back(unblockable*10000); | |
| 5362 | 66188 | ev.push_back(wpnId*10000); | |
| 5363 | 66188 | ev.push_back(0); | |
| 5364 | 66188 | ev.push_back(getUID()); | |
| 5365 | 66188 | ev.push_back(wuid); | |
| 5366 | |||
| 5367 | 66188 | throwGenScriptEvent(GENSCR_EVENT_ENEMY_HIT1); | |
| 5368 | 66188 | *power = ev[0]/10000; | |
| 5369 | 66188 | edef = ev[1]/10000; | |
| 5370 | 66188 | unblockable = byte(ev[2]/10000); | |
| 5371 | 66188 | wpnId = ev[3] / 10000; | |
| 5372 | 66188 | bool nullify = ev[4]!=0; | |
| 5373 | 66188 | ev.clear(); | |
| 5374 | 66188 | int ret = 0; | |
| 5375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 66188 times.
|
66188 | if(!nullify) |
| 5376 | { | ||
| 5377 | 66188 | ret = defendNew(wpnId, power, edef, unblockable); | |
| 5378 |
2/2✓ Branch 0 taken 17195 times.
✓ Branch 1 taken 48993 times.
|
66188 | if(ret == -1) |
| 5379 | { | ||
| 5380 | 48993 | ev.push_back(*power*10000); | |
| 5381 | 48993 | ev.push_back(edef*10000); | |
| 5382 | 48993 | ev.push_back(unblockable*10000); | |
| 5383 | 48993 | ev.push_back(wpnId*10000); | |
| 5384 | 48993 | ev.push_back(0); | |
| 5385 | 48993 | ev.push_back(getUID()); | |
| 5386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48993 times.
|
48993 | ev.push_back(w?w->getUID():0); |
| 5387 | |||
| 5388 | 48993 | throwGenScriptEvent(GENSCR_EVENT_ENEMY_HIT2); | |
| 5389 | 48993 | *power = ev[0]/10000; | |
| 5390 | 48993 | nullify = ev[4]!=0; | |
| 5391 | 48993 | ev.clear(); | |
| 5392 | 48993 | } | |
| 5393 | 66188 | } | |
| 5394 |
1/2✓ Branch 0 taken 66188 times.
✗ Branch 1 not taken.
|
66188 | if(fakeweap) |
| 5395 | ✗ | Lwpns.remove(w); | |
| 5396 | |||
| 5397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 66188 times.
|
66188 | return nullify ? 0 : ret; |
| 5398 | } | ||
| 5399 | |||
| 5400 | 49686 | int32_t enemy::defenditemclassNew(int32_t wpnId, int32_t *power, weapon *w, weapon* realweap) | |
| 5401 | { | ||
| 5402 |
2/2✓ Branch 0 taken 49457 times.
✓ Branch 1 taken 229 times.
|
49686 | if(!realweap) realweap = w; |
| 5403 | 49686 | int32_t wid = getWeaponID(w); | |
| 5404 | |||
| 5405 | 49686 | int32_t edef = resolveEnemyDefence(w); | |
| 5406 |
2/2✓ Branch 0 taken 1255 times.
✓ Branch 1 taken 48431 times.
|
49686 | if(QHeader.zelda_version > 0x250) |
| 5407 | 1255 | return defendNewInt(wid, power, edef, w->unblockable, realweap); | |
| 5408 |
2/3✓ Branch 0 taken 952 times.
✓ Branch 1 taken 47479 times.
✗ Branch 2 not taken.
|
48431 | switch(wid) |
| 5409 | { | ||
| 5410 | case wScript1: case wScript2: case wScript3: case wScript4: case wScript5: | ||
| 5411 | case wScript6: case wScript7: case wScript8: case wScript9: case wScript10: | ||
| 5412 | 952 | return defend(wpnId, power, edefSCRIPT); | |
| 5413 | |||
| 5414 | case wWhistle: | ||
| 5415 | ✗ | return -1; | |
| 5416 | |||
| 5417 | default: | ||
| 5418 | 47479 | return defendNewInt(wid, power, edef, w->unblockable, realweap); | |
| 5419 | } | ||
| 5420 | 49686 | } | |
| 5421 | |||
| 5422 | |||
| 5423 | // Check defenses without actually acting on them. | ||
| 5424 | 11966 | bool enemy::candamage(int32_t power, int32_t edef, byte unblockable) | |
| 5425 | { | ||
| 5426 |
4/10✓ Branch 0 taken 9574 times.
✓ Branch 1 taken 2059 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
11966 | switch(defense[edef]) |
| 5427 | { | ||
| 5428 | case edSTUNONLY: | ||
| 5429 | 8 | return false; | |
| 5430 | case edSTUNORCHINK: | ||
| 5431 | case edCHINK: | ||
| 5432 | 9574 | return unblockable&WPNUNB_BLOCK; | |
| 5433 | case edSTUNORIGNORE: | ||
| 5434 | case edIGNORE: | ||
| 5435 | 2059 | return unblockable&WPNUNB_IGNR; | |
| 5436 | |||
| 5437 | case edIGNOREL1: | ||
| 5438 | ✗ | return (unblockable&WPNUNB_IGNR) || power >= 1*game->get_hero_dmgmult(); | |
| 5439 | case edCHINKL1: | ||
| 5440 | ✗ | return (unblockable&WPNUNB_BLOCK) || power >= 1*game->get_hero_dmgmult(); | |
| 5441 | |||
| 5442 | case edCHINKL2: | ||
| 5443 | ✗ | return (unblockable&WPNUNB_BLOCK) || power >= 2*game->get_hero_dmgmult(); | |
| 5444 | |||
| 5445 | case edCHINKL4: | ||
| 5446 | ✗ | return (unblockable&WPNUNB_BLOCK) || power >= 4*game->get_hero_dmgmult(); | |
| 5447 | |||
| 5448 | case edCHINKL6: | ||
| 5449 | ✗ | return (unblockable&WPNUNB_BLOCK) || power >= 6*game->get_hero_dmgmult(); | |
| 5450 | |||
| 5451 | case edCHINKL8: | ||
| 5452 | ✗ | return (unblockable&WPNUNB_BLOCK) || power >= 8*game->get_hero_dmgmult(); | |
| 5453 | } | ||
| 5454 | |||
| 5455 | 325 | return true; | |
| 5456 | 11966 | } | |
| 5457 | |||
| 5458 | // Do we do damage? | ||
| 5459 | // 0: takehit returns 0 | ||
| 5460 | // 1: takehit returns 1 | ||
| 5461 | // -1: do damage | ||
| 5462 | 952 | int32_t enemy::defend(int32_t wpnId, int32_t *power, int32_t edef) | |
| 5463 | { | ||
| 5464 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 952 times.
|
952 | if(shieldCanBlock) |
| 5465 | { | ||
| 5466 | ✗ | switch(defense[edef]) | |
| 5467 | { | ||
| 5468 | case edIGNORE: | ||
| 5469 | ✗ | return 0; | |
| 5470 | case edIGNOREL1: | ||
| 5471 | case edSTUNORIGNORE: | ||
| 5472 | ✗ | if(*power <= 0) | |
| 5473 | ✗ | return 0; | |
| 5474 | ✗ | } | |
| 5475 | |||
| 5476 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5477 | ✗ | return 1; | |
| 5478 | } | ||
| 5479 | |||
| 5480 |
3/22✓ Branch 0 taken 186 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 759 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 7 times.
|
952 | switch(defense[edef]) |
| 5481 | { | ||
| 5482 | case edSTUNORCHINK: | ||
| 5483 | ✗ | if(*power <= 0) | |
| 5484 | { | ||
| 5485 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5486 | ✗ | return 1; | |
| 5487 | } | ||
| 5488 | |||
| 5489 | [[fallthrough]]; | ||
| 5490 | case edSTUNORIGNORE: | ||
| 5491 | ✗ | if(*power <= 0) | |
| 5492 | ✗ | return 0; | |
| 5493 | |||
| 5494 | [[fallthrough]]; | ||
| 5495 | case edSTUNONLY: | ||
| 5496 | ✗ | if((wpnId==wFire || wpnId==wBomb || wpnId==wSBomb || wpnId==wHookshot || wpnId==wSword) && stunclk>=159) | |
| 5497 | ✗ | return 1; | |
| 5498 | |||
| 5499 | ✗ | stunclk=160; | |
| 5500 | ✗ | sfx(WAV_EHIT,pan(int32_t(x))); | |
| 5501 | ✗ | return 1; | |
| 5502 | |||
| 5503 | case edFREEZE: | ||
| 5504 | ✗ | frozenclock=-1; | |
| 5505 | //sfx(WAV_FREEZE,pan(int32_t(x))); | ||
| 5506 | ✗ | return 1; | |
| 5507 | |||
| 5508 | case edCHINKL1: | ||
| 5509 | ✗ | if(*power >= 1*game->get_hero_dmgmult()) break; | |
| 5510 | [[fallthrough]]; | ||
| 5511 | case edCHINKL2: | ||
| 5512 | ✗ | if(*power >= 2*game->get_hero_dmgmult()) break; | |
| 5513 | [[fallthrough]]; | ||
| 5514 | case edCHINKL4: | ||
| 5515 | ✗ | if(*power >= 4*game->get_hero_dmgmult()) break; | |
| 5516 | [[fallthrough]]; | ||
| 5517 | case edCHINKL6: | ||
| 5518 | ✗ | if(*power >= 6*game->get_hero_dmgmult()) break; | |
| 5519 | [[fallthrough]]; | ||
| 5520 | case edCHINKL8: | ||
| 5521 | ✗ | if(*power >= 8*game->get_hero_dmgmult()) break; | |
| 5522 | [[fallthrough]]; | ||
| 5523 | case edCHINKL10: | ||
| 5524 | ✗ | if(*power >= 10*game->get_hero_dmgmult()) break; | |
| 5525 | [[fallthrough]]; | ||
| 5526 | case edCHINK: | ||
| 5527 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5528 | ✗ | return 1; | |
| 5529 | case edTRIGGERSECRETS: | ||
| 5530 | ✗ | hidden_entrance(0, true, false, -4); | |
| 5531 | ✗ | break; | |
| 5532 | |||
| 5533 | case edIGNOREL1: | ||
| 5534 | ✗ | if(*power > 0) break; | |
| 5535 | [[fallthrough]]; | ||
| 5536 | case edIGNORE: | ||
| 5537 | 759 | return 0; | |
| 5538 | |||
| 5539 | case ed1HKO: | ||
| 5540 | ✗ | *power = hp; | |
| 5541 | ✗ | return -2; | |
| 5542 | |||
| 5543 | case ed2x: | ||
| 5544 | { | ||
| 5545 | ✗ | *power = zc_max(1,*power*2); | |
| 5546 | //int32_t pow = *power; | ||
| 5547 | //*power = vbound((pow*2),0,214747); | ||
| 5548 | ✗ | return -1; | |
| 5549 | } | ||
| 5550 | case ed3x: | ||
| 5551 | { | ||
| 5552 | ✗ | *power = zc_max(1,*power*3); | |
| 5553 | //int32_t pow = *power; | ||
| 5554 | //*power = vbound((pow*3),0,214747); | ||
| 5555 | ✗ | return -1; | |
| 5556 | } | ||
| 5557 | |||
| 5558 | case ed4x: | ||
| 5559 | { | ||
| 5560 | ✗ | *power = zc_max(1,*power*4); | |
| 5561 | //int32_t pow = *power; | ||
| 5562 | //*power = vbound((pow*4),0,214747); | ||
| 5563 | ✗ | return -1; | |
| 5564 | } | ||
| 5565 | |||
| 5566 | |||
| 5567 | case edHEAL: | ||
| 5568 | { //Probably needs its own function, or routine in the damage functuon to heal if power is negative. | ||
| 5569 | //int32_t pow = *power; | ||
| 5570 | //*power = vbound((pow*-1),0,214747); | ||
| 5571 | //break; | ||
| 5572 | ✗ | *power = zc_min(0,*power*-1); | |
| 5573 | ✗ | return -1; | |
| 5574 | } | ||
| 5575 | /* | ||
| 5576 | case edLEVELDAMAGE: | ||
| 5577 | { | ||
| 5578 | int32_t pow = *power; | ||
| 5579 | int32_t lvl = *level; | ||
| 5580 | *power = vbound((pow*lvl),0,214747); | ||
| 5581 | break; | ||
| 5582 | } | ||
| 5583 | case edLEVELREDUCTION: | ||
| 5584 | { | ||
| 5585 | int32_t pow = *power; | ||
| 5586 | int32_t lvl = *level; | ||
| 5587 | *power = vbound((pow/lvl),0,214747); | ||
| 5588 | break; | ||
| 5589 | } | ||
| 5590 | */ | ||
| 5591 | |||
| 5592 | |||
| 5593 | case edQUARTDAMAGE: | ||
| 5594 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | *power = zc_max(1,*power/2); |
| 5595 | |||
| 5596 | [[fallthrough]]; | ||
| 5597 | case edHALFDAMAGE: | ||
| 5598 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | *power = zc_max(1,*power/2); |
| 5599 | 7 | break; | |
| 5600 | } | ||
| 5601 | |||
| 5602 | 193 | return -1; | |
| 5603 | 952 | } | |
| 5604 | |||
| 5605 | // Defend against a particular item class. | ||
| 5606 | ✗ | int32_t enemy::defenditemclass(int32_t wpnId, int32_t *power) | |
| 5607 | { | ||
| 5608 | ✗ | int32_t def=-1; | |
| 5609 | |||
| 5610 | ✗ | switch(wpnId) | |
| 5611 | { | ||
| 5612 | // These first 2 are only used by Gohma... enemy::takehit() has complicated stun-calculation code for these. | ||
| 5613 | case wBrang: | ||
| 5614 | ✗ | def = defend(wpnId, power, edefBRANG); | |
| 5615 | ✗ | break; | |
| 5616 | |||
| 5617 | case wHookshot: | ||
| 5618 | ✗ | def = defend(wpnId, power, edefHOOKSHOT); | |
| 5619 | ✗ | break; | |
| 5620 | |||
| 5621 | // Anyway... | ||
| 5622 | case wBomb: | ||
| 5623 | ✗ | def = defend(wpnId, power, edefBOMB); | |
| 5624 | ✗ | break; | |
| 5625 | |||
| 5626 | case wSBomb: | ||
| 5627 | ✗ | def = defend(wpnId, power, edefSBOMB); | |
| 5628 | ✗ | break; | |
| 5629 | |||
| 5630 | case wArrow: | ||
| 5631 | ✗ | def = defend(wpnId, power, edefARROW); | |
| 5632 | ✗ | break; | |
| 5633 | |||
| 5634 | case wFire: | ||
| 5635 | ✗ | def = defend(wpnId, power, edefFIRE); | |
| 5636 | ✗ | break; | |
| 5637 | |||
| 5638 | case wWand: | ||
| 5639 | ✗ | def = defend(wpnId, power, edefWAND); | |
| 5640 | ✗ | break; | |
| 5641 | |||
| 5642 | case wMagic: | ||
| 5643 | ✗ | def = defend(wpnId, power, edefMAGIC); | |
| 5644 | ✗ | break; | |
| 5645 | |||
| 5646 | case wHammer: | ||
| 5647 | ✗ | def = defend(wpnId, power, edefHAMMER); | |
| 5648 | ✗ | break; | |
| 5649 | |||
| 5650 | case wSword: | ||
| 5651 | ✗ | def = defend(wpnId, power, edefSWORD); | |
| 5652 | ✗ | break; | |
| 5653 | |||
| 5654 | case wBeam: | ||
| 5655 | ✗ | def = defend(wpnId, power, edefBEAM); | |
| 5656 | ✗ | break; | |
| 5657 | |||
| 5658 | case wRefBeam: | ||
| 5659 | ✗ | def = defend(wpnId, power, edefREFBEAM); | |
| 5660 | ✗ | break; | |
| 5661 | |||
| 5662 | case wRefMagic: | ||
| 5663 | ✗ | def = defend(wpnId, power, edefREFMAGIC); | |
| 5664 | ✗ | break; | |
| 5665 | |||
| 5666 | case wRefFireball: | ||
| 5667 | ✗ | def = defend(wpnId, power, edefREFBALL); | |
| 5668 | ✗ | break; | |
| 5669 | |||
| 5670 | case wRefRock: | ||
| 5671 | ✗ | def = defend(wpnId, power, edefREFROCK); | |
| 5672 | ✗ | break; | |
| 5673 | |||
| 5674 | case wStomp: | ||
| 5675 | ✗ | def = defend(wpnId, power, edefSTOMP); | |
| 5676 | ✗ | break; | |
| 5677 | |||
| 5678 | case wCByrna: | ||
| 5679 | ✗ | def = defend(wpnId, power, edefBYRNA); | |
| 5680 | ✗ | break; | |
| 5681 | |||
| 5682 | case wScript1: | ||
| 5683 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT01); | |
| 5684 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5685 | ✗ | break; | |
| 5686 | |||
| 5687 | case wScript2: | ||
| 5688 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT02); | |
| 5689 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5690 | ✗ | break; | |
| 5691 | |||
| 5692 | case wScript3: | ||
| 5693 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT03); | |
| 5694 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5695 | ✗ | break; | |
| 5696 | |||
| 5697 | case wScript4: | ||
| 5698 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT04); | |
| 5699 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5700 | ✗ | break; | |
| 5701 | |||
| 5702 | case wScript5: | ||
| 5703 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT05); | |
| 5704 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5705 | ✗ | break; | |
| 5706 | |||
| 5707 | case wScript6: | ||
| 5708 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT06); | |
| 5709 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5710 | ✗ | break; | |
| 5711 | |||
| 5712 | case wScript7: | ||
| 5713 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT07); | |
| 5714 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5715 | ✗ | break; | |
| 5716 | |||
| 5717 | case wScript8: | ||
| 5718 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT08); | |
| 5719 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5720 | ✗ | break; | |
| 5721 | |||
| 5722 | case wScript9: | ||
| 5723 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT09); | |
| 5724 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5725 | ✗ | break; | |
| 5726 | |||
| 5727 | case wScript10: | ||
| 5728 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefSCRIPT10); | |
| 5729 | ✗ | else def = defend(wpnId, power, edefSCRIPT); | |
| 5730 | ✗ | break; | |
| 5731 | |||
| 5732 | case wWhistle: | ||
| 5733 | ✗ | if(QHeader.zelda_version > 0x250) def = defend(wpnId, power, edefWhistle); | |
| 5734 | ✗ | else break; | |
| 5735 | ✗ | break; | |
| 5736 | |||
| 5737 | |||
| 5738 | //!ZoriaRPG : We need some special cases here, to ensure that old script defs don;t break. | ||
| 5739 | //Probably best to do this from the qest file, loading the values of Script(generic) into each | ||
| 5740 | //of the ten if the quest version is lower than N. | ||
| 5741 | //Either that, or we need a boolean flag to set int32_t he enemy editor, or by ZScript that changes this behaviour. | ||
| 5742 | //such as bool UseSeparatedScriptDefences. hah. | ||
| 5743 | default: | ||
| 5744 | //if(wpnId>=wScript1 && wpnId<=wScript10) | ||
| 5745 | // { | ||
| 5746 | // def = defend(wpnId, power, edefSCRIPT); | ||
| 5747 | // } | ||
| 5748 | // } | ||
| 5749 | |||
| 5750 | ✗ | break; | |
| 5751 | } | ||
| 5752 | |||
| 5753 | ✗ | return def; | |
| 5754 | } | ||
| 5755 | |||
| 5756 | // take damage or ignore it | ||
| 5757 | // -1: damage (if any) dealt | ||
| 5758 | // 1: blocked | ||
| 5759 | // 0: weapon passes through unhindered | ||
| 5760 | 147753 | int32_t enemy::takehit(weapon *w, weapon* realweap) | |
| 5761 | { | ||
| 5762 |
2/4✓ Branch 0 taken 147753 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 147753 times.
|
147753 | if(fallclk||drownclk) return 0; |
| 5763 |
2/2✓ Branch 0 taken 32567 times.
✓ Branch 1 taken 115186 times.
|
147753 | if(!realweap) realweap = w; |
| 5764 | 147753 | int32_t wpnId = w->id; | |
| 5765 | 147753 | int32_t power = w->power; | |
| 5766 | 147753 | int32_t wpnx = w->x; | |
| 5767 | 147753 | int32_t wpny = w->y; | |
| 5768 | 147753 | int32_t enemyHitWeapon = w->parentitem; | |
| 5769 | int32_t wpnDir; | ||
| 5770 | 147753 | int32_t parent_item = w->parentitem; | |
| 5771 | |||
| 5772 |
1/2✓ Branch 0 taken 147753 times.
✗ Branch 1 not taken.
|
147753 | if ( w->useweapon > 0 /*&& wpnId != wWhistle*/ ) |
| 5773 | { | ||
| 5774 | ✗ | wpnId = w->useweapon; | |
| 5775 | ✗ | } | |
| 5776 | |||
| 5777 | // If it's a boomerang that just bounced, use the opposite direction; | ||
| 5778 | // otherwise, it might bypass a shield. This probably won't handle | ||
| 5779 | // every case correctly, but it's better than having shields simply | ||
| 5780 | // not work against boomerangs. | ||
| 5781 |
8/8✓ Branch 0 taken 17063 times.
✓ Branch 1 taken 130690 times.
✓ Branch 2 taken 10616 times.
✓ Branch 3 taken 6447 times.
✓ Branch 4 taken 10228 times.
✓ Branch 5 taken 388 times.
✓ Branch 6 taken 2514 times.
✓ Branch 7 taken 7714 times.
|
147753 | if(w->id==wBrang && w->misc==1 && w->clk2>=256 && w->clk2<264) |
| 5782 | 7714 | wpnDir = oppositeDir[w->dir]; | |
| 5783 | else | ||
| 5784 | 140039 | wpnDir = w->dir; | |
| 5785 | |||
| 5786 |
5/8✓ Branch 0 taken 147753 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147753 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 147753 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2483 times.
✓ Branch 7 taken 148128 times.
|
147753 | if(dying || clk<0 || hclk>0 || superman) |
| 5787 | 2483 | return 0; | |
| 5788 | |||
| 5789 | //Prevent boomerang from writing to hitby[] for more than one frame. | ||
| 5790 | //This also prevents stunlock. | ||
| 5791 | //if ( stunclk > 0 ) return 0; | ||
| 5792 | //this needs a rule for boomerangs that cannot stunlock! | ||
| 5793 | //further, bouncing weapons should probably SFX_CHINK and bounce here. | ||
| 5794 | //sigh. | ||
| 5795 | |||
| 5796 | 148128 | int32_t ret = -1; | |
| 5797 | |||
| 5798 | // This obscure quest rule... | ||
| 5799 |
5/6✓ Branch 0 taken 74548 times.
✓ Branch 1 taken 73580 times.
✓ Branch 2 taken 74420 times.
✓ Branch 3 taken 128 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 74420 times.
|
148128 | if(get_bit(quest_rules,qr_BOMBDARKNUTFIX) && (wpnId==wBomb || wpnId==wSBomb)) |
| 5800 | { | ||
| 5801 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 5802 | 128 | double ddir=atan2_MSVC2022_FIX(double(wpny-y),double(x-wpnx)); | |
| 5803 | 128 | wpnDir=zc_oldrand()&3; | |
| 5804 | |||
| 5805 |
4/4✓ Branch 0 taken 77 times.
✓ Branch 1 taken 51 times.
✓ Branch 2 taken 24 times.
✓ Branch 3 taken 53 times.
|
128 | if((ddir<=(((-1)*PI)/4))&&(ddir>(((-3)*PI)/4))) |
| 5806 | { | ||
| 5807 | 53 | wpnDir=down; | |
| 5808 | 53 | } | |
| 5809 |
4/4✓ Branch 0 taken 60 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 24 times.
✓ Branch 3 taken 36 times.
|
75 | else if((ddir<=(((1)*PI)/4))&&(ddir>(((-1)*PI)/4))) |
| 5810 | { | ||
| 5811 | 36 | wpnDir=right; | |
| 5812 | 36 | } | |
| 5813 |
4/4✓ Branch 0 taken 31 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 24 times.
✓ Branch 3 taken 7 times.
|
39 | else if((ddir<=(((3)*PI)/4))&&(ddir>(((1)*PI)/4))) |
| 5814 | { | ||
| 5815 | 7 | wpnDir=up; | |
| 5816 | 7 | } | |
| 5817 | else | ||
| 5818 | { | ||
| 5819 | 32 | wpnDir=left; | |
| 5820 | } | ||
| 5821 | 128 | } | |
| 5822 | |||
| 5823 | 148128 | int32_t xdir = dir; | |
| 5824 | 148128 | shieldCanBlock=false; | |
| 5825 | |||
| 5826 | //if (family==eeFLOAT && flags&(inv_front|inv_back_inv_left|inv_right)) xdir=down; | ||
| 5827 |
4/4✓ Branch 0 taken 146284 times.
✓ Branch 1 taken 1844 times.
✓ Branch 2 taken 406 times.
✓ Branch 3 taken 145878 times.
|
148922 | if(!(w->unblockable&WPNUNB_BLOCK)&&((wpnId==wHookshot && hitshield(wpnx, wpny, xdir)) |
| 5828 |
10/10✓ Branch 0 taken 13331 times.
✓ Branch 1 taken 12925 times.
✓ Branch 2 taken 17937 times.
✓ Branch 3 taken 140866 times.
✓ Branch 4 taken 56 times.
✓ Branch 5 taken 140810 times.
✓ Branch 6 taken 982 times.
✓ Branch 7 taken 139828 times.
✓ Branch 8 taken 794 times.
✓ Branch 9 taken 139034 times.
|
146284 | || ((flags&inv_front && wpnDir==(xdir^down)) || (flags&inv_back && wpnDir==(xdir^up)) || (flags&inv_left && wpnDir==(xdir^left)) || (flags&inv_right && wpnDir==(xdir^right)))) |
| 5829 | ) | ||
| 5830 | // The hammer should already be dealt with by subclasses (Walker etc.) | ||
| 5831 | { | ||
| 5832 |
9/9✓ Branch 0 taken 423 times.
✓ Branch 1 taken 263 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 3678 times.
✓ Branch 4 taken 252 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1317 times.
✓ Branch 8 taken 484 times.
|
33100 | switch(wpnId) |
| 5833 | { | ||
| 5834 | // Weapons which shields protect against | ||
| 5835 | case wSword: | ||
| 5836 | case wWand: | ||
| 5837 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3678 times.
|
3678 | if(Hero.getCharging()>0) |
| 5838 | ✗ | Hero.setAttackClk(Hero.getAttackClk()+1); //Cancel charging | |
| 5839 | |||
| 5840 | [[fallthrough]]; | ||
| 5841 | case wHookshot: | ||
| 5842 | case wHSHandle: | ||
| 5843 | case wBrang: | ||
| 5844 | 3941 | shieldCanBlock=true; | |
| 5845 | 4193 | break; | |
| 5846 | |||
| 5847 | case wBeam: | ||
| 5848 | case wRefBeam: | ||
| 5849 | // Mirror shielded enemies! | ||
| 5850 | #if 0 | ||
| 5851 | if(false /*flags2&guy_mirror*/ && !get_bit(quest_rules,qr_SWORDMIRROR)) | ||
| 5852 | { | ||
| 5853 | if(wpnId>wEnemyWeapons) | ||
| 5854 | return 0; | ||
| 5855 | |||
| 5856 | sfx(WAV_CHINK,pan(int32_t(x))); | ||
| 5857 | return 1; | ||
| 5858 | } | ||
| 5859 | |||
| 5860 | #endif | ||
| 5861 | |||
| 5862 | [[fallthrough]]; | ||
| 5863 | case wRefRock: | ||
| 5864 | case wRefFireball: | ||
| 5865 | case wMagic: | ||
| 5866 | #if 0 | ||
| 5867 | if(false /*flags2&guy_mirror*/ && (wpnId!=wRefRock || get_bit(quest_rules,qr_REFLECTROCKS))) | ||
| 5868 | { | ||
| 5869 | sfx(WAV_CHINK,pan(int32_t(x))); | ||
| 5870 | return 3; | ||
| 5871 | } | ||
| 5872 | |||
| 5873 | #endif | ||
| 5874 | |||
| 5875 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 268 times.
|
268 | if(wpnId>wEnemyWeapons) |
| 5876 | ✗ | return 0; | |
| 5877 | |||
| 5878 | [[fallthrough]]; | ||
| 5879 | default: | ||
| 5880 | 1585 | shieldCanBlock=true; | |
| 5881 | 1585 | break; | |
| 5882 | |||
| 5883 | // Bombs | ||
| 5884 | case wSBomb: | ||
| 5885 | case wBomb: | ||
| 5886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if (!get_bit(quest_rules,qr_TRUEFIXEDBOMBSHIELD)) goto hitclock; |
| 5887 | ✗ | else if (!get_bit(quest_rules,qr_BOMBSPIERCESHIELD)) | |
| 5888 | { | ||
| 5889 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 5890 | ✗ | return 0; | |
| 5891 | } | ||
| 5892 | ✗ | else break; | |
| 5893 | |||
| 5894 | // Weapons which ignore shields | ||
| 5895 | case wWhistle: | ||
| 5896 | case wHammer: | ||
| 5897 | 1 | break; | |
| 5898 | |||
| 5899 | // Weapons which shouldn't be removed by shields | ||
| 5900 | case wLitBomb: | ||
| 5901 | case wLitSBomb: | ||
| 5902 | case wWind: | ||
| 5903 | case wPhantom: | ||
| 5904 | case wSSparkle: | ||
| 5905 | case wBait: | ||
| 5906 | 423 | return 0; | |
| 5907 | |||
| 5908 | [[fallthrough]]; | ||
| 5909 | case wFire: | ||
| 5910 | #if 0 | ||
| 5911 | if(false /*flags2&guy_mirror*/) | ||
| 5912 | { | ||
| 5913 | sfx(WAV_CHINK,pan(int32_t(x))); | ||
| 5914 | return 1; | ||
| 5915 | } | ||
| 5916 | |||
| 5917 | #endif | ||
| 5918 | ; | ||
| 5919 | 484 | } | |
| 5920 | 6011 | } | |
| 5921 | |||
| 5922 |
7/8✓ Branch 0 taken 66681 times.
✓ Branch 1 taken 49014 times.
✓ Branch 2 taken 211 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11966 times.
✓ Branch 5 taken 17048 times.
✓ Branch 6 taken 406 times.
✓ Branch 7 taken 1563 times.
|
146889 | switch(wpnId) |
| 5923 | { | ||
| 5924 | case wWhistle: //No longer completely ignore whistle weapons! -Z | ||
| 5925 | { | ||
| 5926 | |||
| 5927 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 211 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
211 | if ( ((itemsbuf[parent_item].flags & ITEM_FLAG2) == 0) || ( parent_item == -1 ) ) //if the flag is set, or the weapon is scripted |
| 5928 | { | ||
| 5929 | //al_trace("Whistle weapon in %s\n", "takehit flag == 0"); | ||
| 5930 | 211 | return 0; break; | |
| 5931 | } | ||
| 5932 | else | ||
| 5933 | { | ||
| 5934 | ✗ | w->power = power = itemsbuf[parent_item].misc5; | |
| 5935 | |||
| 5936 | ✗ | int32_t def = defendNewInt(wpnId, &power, resolveEnemyDefence(w), w->unblockable, realweap); | |
| 5937 | |||
| 5938 | ✗ | if(def <= 0) | |
| 5939 | { | ||
| 5940 | ✗ | if ( def == -2 ) hp -= hp; | |
| 5941 | ✗ | else hp -= power; | |
| 5942 | ✗ | return def; | |
| 5943 | } | ||
| 5944 | ✗ | break; | |
| 5945 | } | ||
| 5946 | break; | ||
| 5947 | } | ||
| 5948 | |||
| 5949 | case wPhantom: | ||
| 5950 | ✗ | return 0; | |
| 5951 | |||
| 5952 | case wLitBomb: | ||
| 5953 | case wLitSBomb: | ||
| 5954 | case wBait: | ||
| 5955 | case wWind: | ||
| 5956 | case wSSparkle: | ||
| 5957 | 66681 | return 0; | |
| 5958 | |||
| 5959 | case wFSparkle: | ||
| 5960 | |||
| 5961 | // Only take sparkle damage if the sparkle's parent item is not | ||
| 5962 | // defended against. | ||
| 5963 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11966 times.
|
11966 | if(enemyHitWeapon > -1) |
| 5964 | { | ||
| 5965 | 11966 | int32_t p = 0; | |
| 5966 | 11966 | int32_t f = itemsbuf[enemyHitWeapon].family; | |
| 5967 | |||
| 5968 |
1/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 11966 times.
|
11966 | switch(f) |
| 5969 | { | ||
| 5970 | case itype_arrow: | ||
| 5971 | ✗ | if(!candamage(p, edefARROW, w->unblockable)) return 0; | |
| 5972 | |||
| 5973 | ✗ | break; | |
| 5974 | |||
| 5975 | case itype_cbyrna: | ||
| 5976 | ✗ | if(!candamage(p, edefBYRNA, w->unblockable)) return 0; | |
| 5977 | |||
| 5978 | ✗ | break; | |
| 5979 | |||
| 5980 | case itype_brang: | ||
| 5981 |
2/2✓ Branch 0 taken 325 times.
✓ Branch 1 taken 11641 times.
|
11966 | if(!candamage(p, edefBRANG, w->unblockable)) return 0; |
| 5982 | |||
| 5983 | 325 | break; | |
| 5984 | |||
| 5985 | default: | ||
| 5986 | ✗ | return 0; | |
| 5987 | } | ||
| 5988 | 325 | } | |
| 5989 | |||
| 5990 | 325 | wpnId = wSword; | |
| 5991 | 325 | power = game->get_hero_dmgmult()>>1; | |
| 5992 | 325 | goto fsparkle; | |
| 5993 | break; | ||
| 5994 | |||
| 5995 | case wBrang: | ||
| 5996 | { | ||
| 5997 | //int32_t def = defendNew(wpnId, &power, edefBRANG, w); | ||
| 5998 | 17048 | int32_t def = defendNewInt(wpnId, &power, resolveEnemyDefence(w), w->unblockable, realweap); | |
| 5999 | //preventing stunlock might be best, here. -Z | ||
| 6000 |
2/2✓ Branch 0 taken 4165 times.
✓ Branch 1 taken 12883 times.
|
17048 | if(def >= 0) return def; |
| 6001 | |||
| 6002 | // Not hurt by 0-damage weapons | ||
| 6003 |
2/2✓ Branch 0 taken 2173 times.
✓ Branch 1 taken 10710 times.
|
12883 | if(!(flags & guy_bhit)) |
| 6004 | { | ||
| 6005 | 10710 | stunclk=160; | |
| 6006 | |||
| 6007 |
3/4✓ Branch 0 taken 10710 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1200 times.
✓ Branch 3 taken 9510 times.
|
10710 | if(enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_brang)) |
| 6008 | { | ||
| 6009 |
1/2✓ Branch 0 taken 1200 times.
✗ Branch 1 not taken.
|
1200 | hp -= (enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_brang))*game->get_hero_dmgmult(); |
| 6010 | 1200 | goto hitclock; | |
| 6011 | } | ||
| 6012 | |||
| 6013 | 9510 | break; | |
| 6014 | } | ||
| 6015 | |||
| 6016 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 1789 times.
|
2173 | if(!power) |
| 6017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1789 times.
|
1789 | hp-=(enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].fam_type : current_item(itype_brang))*game->get_hero_dmgmult(); |
| 6018 | else | ||
| 6019 | 384 | hp-=power; | |
| 6020 | |||
| 6021 | 2173 | goto hitclock; | |
| 6022 | } | ||
| 6023 | |||
| 6024 | case wHookshot: | ||
| 6025 | { | ||
| 6026 | //int32_t def = defendNew(wpnId, &power, edefHOOKSHOT,w); | ||
| 6027 | 406 | int32_t def = defendNewInt(wpnId, &power, resolveEnemyDefence(w), w->unblockable, realweap); | |
| 6028 | |||
| 6029 |
2/2✓ Branch 0 taken 185 times.
✓ Branch 1 taken 221 times.
|
406 | if(def >= 0) return def; |
| 6030 | |||
| 6031 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 221 times.
|
221 | bool swgrab = switch_hooked || w->family_class == itype_switchhook; |
| 6032 |
3/4✓ Branch 0 taken 221 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 215 times.
✓ Branch 3 taken 6 times.
|
221 | if(swgrab || !(flags & guy_bhit)) |
| 6033 | { | ||
| 6034 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 215 times.
|
215 | if(!swgrab) |
| 6035 | 215 | stunclk=160; | |
| 6036 | |||
| 6037 |
2/4✓ Branch 0 taken 215 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 215 times.
|
215 | if(enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_hookshot)) |
| 6038 | { | ||
| 6039 | ✗ | hp -= (enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_hookshot))*game->get_hero_dmgmult(); | |
| 6040 | ✗ | goto hitclock; | |
| 6041 | } | ||
| 6042 | |||
| 6043 | 215 | break; | |
| 6044 | } | ||
| 6045 | |||
| 6046 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
6 | if(!power) hp-=(enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].fam_type : current_item(itype_hookshot))*game->get_hero_dmgmult(); |
| 6047 | else | ||
| 6048 | ✗ | hp-=power; | |
| 6049 | |||
| 6050 | 6 | goto hitclock; | |
| 6051 | } | ||
| 6052 | break; | ||
| 6053 | |||
| 6054 | case wHSHandle: | ||
| 6055 | { | ||
| 6056 |
3/4✓ Branch 0 taken 1563 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 79 times.
✓ Branch 3 taken 1484 times.
|
1563 | if(itemsbuf[enemyHitWeapon>-1 ? enemyHitWeapon : current_item_id(itype_hookshot)].flags & ITEM_FLAG1) |
| 6057 | 79 | return 0; | |
| 6058 | |||
| 6059 |
3/4✓ Branch 0 taken 1093 times.
✓ Branch 1 taken 391 times.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
1484 | bool ignorehookshot = ((defense[edefHOOKSHOT] == edIGNORE) || ((defense[edefHOOKSHOT] == edIGNOREL1 || defense[edefHOOKSHOT] == edSTUNORIGNORE) |
| 6060 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
391 | && (enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_hookshot)) <= 0)); |
| 6061 | |||
| 6062 | // Peahats, Darknuts, Aquamentuses, Pols Voices, Wizzrobes, Manhandlas | ||
| 6063 |
6/8✓ Branch 0 taken 452 times.
✓ Branch 1 taken 1032 times.
✓ Branch 2 taken 452 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 452 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 370 times.
|
1801 | if(!(family==eePEAHAT || family==eeAQUA || family==eeMANHAN || (family==eeWIZZ && !ignorehookshot) |
| 6064 |
6/6✓ Branch 0 taken 598 times.
✓ Branch 1 taken 516 times.
✓ Branch 2 taken 317 times.
✓ Branch 3 taken 651 times.
✓ Branch 4 taken 317 times.
✓ Branch 5 taken 334 times.
|
452 | || (family==eeWALK && dmisc9==e9tPOLSVOICE) || (family==eeWALK && flags&(inv_back|inv_front|inv_left|inv_right)))) |
| 6065 | 334 | return 0; | |
| 6066 | |||
| 6067 | 2182 | power = game->get_hero_dmgmult(); | |
| 6068 | 2507 | } | |
| 6069 | |||
| 6070 | fsparkle: | ||
| 6071 | |||
| 6072 | [[fallthrough]]; | ||
| 6073 | default: | ||
| 6074 | // Work out the defenses! | ||
| 6075 | { | ||
| 6076 | 49457 | int32_t def = defenditemclassNew(wpnId, &power, w, realweap); | |
| 6077 | |||
| 6078 |
2/2✓ Branch 0 taken 13168 times.
✓ Branch 1 taken 36289 times.
|
49457 | if(def >= 0) |
| 6079 | 13168 | return def; | |
| 6080 |
2/2✓ Branch 0 taken 36006 times.
✓ Branch 1 taken 283 times.
|
36289 | else if(def == -2) |
| 6081 | { | ||
| 6082 | 283 | ret = 0; | |
| 6083 | 283 | } | |
| 6084 | } | ||
| 6085 | |||
| 6086 |
2/2✓ Branch 0 taken 36287 times.
✓ Branch 1 taken 2 times.
|
72578 | if(!power) |
| 6087 | { | ||
| 6088 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(flags & guy_bhit) |
| 6089 | 2 | hp-=1; | |
| 6090 | else | ||
| 6091 | { | ||
| 6092 | // Don't make a long chain of 'stun' hits | ||
| 6093 | ✗ | if((wpnId==wFire || wpnId==wBomb || wpnId==wSBomb || wpnId==wSword) && stunclk>0) | |
| 6094 | ✗ | return 1; | |
| 6095 | |||
| 6096 | |||
| 6097 | ✗ | if(!switch_hooked) | |
| 6098 | ✗ | stunclk=160; | |
| 6099 | ✗ | break; | |
| 6100 | } | ||
| 6101 | 2 | } | |
| 6102 | 36287 | else hp-=power; | |
| 6103 | |||
| 6104 | hitclock: | ||
| 6105 | 39672 | hclk=33; | |
| 6106 | |||
| 6107 | // Use w->dir instead of wpnDir to make sure boomerangs don't push enemies the wrong way | ||
| 6108 |
2/2✓ Branch 0 taken 18464 times.
✓ Branch 1 taken 21208 times.
|
39672 | if((dir&2)==(w->dir&2)) |
| 6109 | { | ||
| 6110 | 21208 | sclk=(w->dir<<8)+16; | |
| 6111 | 21208 | } | |
| 6112 | 39672 | } | |
| 6113 | |||
| 6114 |
5/6✓ Branch 0 taken 36514 times.
✓ Branch 1 taken 12883 times.
✓ Branch 2 taken 5440 times.
✓ Branch 3 taken 43957 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5440 times.
|
49397 | if(((wpnId==wBrang) || (get_bit(quest_rules,qr_NOFLASHDEATH))) && (hp<=0 && !immortal)) |
| 6115 | { | ||
| 6116 | 5440 | fading=fade_blue_poof; | |
| 6117 | 5440 | } | |
| 6118 | |||
| 6119 |
6/6✓ Branch 0 taken 48394 times.
✓ Branch 1 taken 1003 times.
✓ Branch 2 taken 34319 times.
✓ Branch 3 taken 14075 times.
✓ Branch 4 taken 1441 times.
✓ Branch 5 taken 32878 times.
|
49397 | if ( FFCore.getQuestHeaderInfo(vZelda) > 0x250 || ( FFCore.getQuestHeaderInfo(vZelda) == 0x250 && FFCore.getQuestHeaderInfo(vBuild) > 31 )) //2.53 Gamma 2 and later |
| 6120 | { | ||
| 6121 |
1/2✓ Branch 0 taken 2444 times.
✗ Branch 1 not taken.
|
2444 | if( hitsfx > 0 ) //user-set hit sound. |
| 6122 | { | ||
| 6123 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2444 times.
|
2444 | if (!dying) //don't play the hit sound on death! -Z |
| 6124 | 2444 | sfx(hitsfx, pan(int32_t(x))); | |
| 6125 | 2444 | } | |
| 6126 | ✗ | else sfx(WAV_EHIT, pan(int32_t(x))); //Don't play the hardcoded sound if the user sets a custom one. | |
| 6127 | 2444 | } | |
| 6128 | else //2.50.2 or earlier | ||
| 6129 | { | ||
| 6130 | 46953 | sfx(WAV_EHIT, pan(int32_t(x))); | |
| 6131 | 46953 | sfx(hitsfx, pan(int32_t(x))); | |
| 6132 | } | ||
| 6133 |
2/2✓ Branch 0 taken 49394 times.
✓ Branch 1 taken 3 times.
|
49397 | if(family==eeGUY) |
| 6134 | 3 | sfx(WAV_EDEAD, pan(int32_t(x))); | |
| 6135 | |||
| 6136 | // Penetrating weapons | ||
| 6137 |
4/4✓ Branch 0 taken 48659 times.
✓ Branch 1 taken 738 times.
✓ Branch 2 taken 43674 times.
✓ Branch 3 taken 5723 times.
|
49397 | if((wpnId==wArrow || wpnId==wBeam) && !cannotpenetrate()) |
| 6138 | { | ||
| 6139 | 5723 | int32_t item=enemyHitWeapon; | |
| 6140 | |||
| 6141 |
2/2✓ Branch 0 taken 587 times.
✓ Branch 1 taken 5136 times.
|
5723 | if(wpnId==wArrow) |
| 6142 | { | ||
| 6143 | //If we use an arrow type for the item's Weapon type, the flags differ, so we need to rely on the flags from an arrow class. | ||
| 6144 |
5/6✓ Branch 0 taken 496 times.
✓ Branch 1 taken 91 times.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 426 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 70 times.
|
587 | if(item>=0 && (itemsbuf[item].flags&ITEM_FLAG1) && (itemsbuf[parent_item].family == itype_arrow)) |
| 6145 | 70 | return 0; | |
| 6146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 517 times.
|
517 | else if(get_bit(quest_rules,qr_ARROWS_ALWAYS_PENETRATE)) return 0; |
| 6147 | //if(item<0) | ||
| 6148 | else | ||
| 6149 | 517 | item=current_item_id(itype_arrow); | |
| 6150 | 517 | } | |
| 6151 | |||
| 6152 | else | ||
| 6153 | { | ||
| 6154 | |||
| 6155 | //If we use an swordbeam type for the item's Weapon type, the flags differ, so we need to rely on the flags from an arrow class. | ||
| 6156 |
3/6✓ Branch 0 taken 5131 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5131 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5136 | if(item>=0 && (itemsbuf[item].flags&ITEM_FLAG3) && (itemsbuf[parent_item].family == itype_sword)) |
| 6157 | ✗ | return 0; | |
| 6158 | |||
| 6159 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5136 times.
|
5136 | else if(get_bit(quest_rules,qr_SWORDBEAMS_ALWAYS_PENETRATE)) return 0; |
| 6160 | else | ||
| 6161 | //if(item<0) | ||
| 6162 | 5136 | item=current_item_id(itype_sword); | |
| 6163 | } | ||
| 6164 | 5653 | } | |
| 6165 | |||
| 6166 | 49327 | return ret; | |
| 6167 | 148767 | } | |
| 6168 | |||
| 6169 | 25905538 | bool enemy::dont_draw() | |
| 6170 | { | ||
| 6171 |
6/6✓ Branch 0 taken 25804769 times.
✓ Branch 1 taken 100769 times.
✓ Branch 2 taken 25733862 times.
✓ Branch 3 taken 70907 times.
✓ Branch 4 taken 30972 times.
✓ Branch 5 taken 25773797 times.
|
25905538 | if(fading==fade_invisible || (((flags2&guy_blinking)||(fading==fade_flicker)) && (clk&1))) |
| 6172 | 131741 | return true; | |
| 6173 | |||
| 6174 |
2/2✓ Branch 0 taken 225193 times.
✓ Branch 1 taken 25548604 times.
|
25773797 | if(flags&guy_invisible) |
| 6175 | 225193 | return true; | |
| 6176 | |||
| 6177 |
3/4✓ Branch 0 taken 432 times.
✓ Branch 1 taken 25548172 times.
✓ Branch 2 taken 432 times.
✗ Branch 3 not taken.
|
25548604 | if(flags&lens_only && !lensclk) |
| 6178 | ✗ | return true; | |
| 6179 | |||
| 6180 |
3/8✓ Branch 0 taken 45951 times.
✓ Branch 1 taken 25502653 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 45951 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
25548604 | if(lensclk && (itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG6) && !(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG7) && |
| 6181 | ✗ | !((flags&lens_only) && (get_bit(quest_rules,qr_LENSSEESENEMIES) || (itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG5)))) | |
| 6182 | ✗ | return true; | |
| 6183 | |||
| 6184 | 25548604 | return false; | |
| 6185 | 25905538 | } | |
| 6186 | |||
| 6187 | #define DRAW_NORMAL 2 | ||
| 6188 | #define DRAW_CLOAKED 1 | ||
| 6189 | #define DRAW_INVIS 0 | ||
| 6190 | // base drawing function to be used by all derived classes instead of | ||
| 6191 | // sprite::draw() | ||
| 6192 | 22766187 | void enemy::draw(BITMAP *dest) | |
| 6193 | { | ||
| 6194 |
6/6✓ Branch 0 taken 22418198 times.
✓ Branch 1 taken 347989 times.
✓ Branch 2 taken 22335548 times.
✓ Branch 3 taken 82650 times.
✓ Branch 4 taken 150759 times.
✓ Branch 5 taken 22267439 times.
|
22766187 | if(fading==fade_invisible || (((flags2&guy_blinking)||(fading==fade_flicker)) && (clk&1))) |
| 6195 | 498748 | return; | |
| 6196 |
2/2✓ Branch 0 taken 1523860 times.
✓ Branch 1 taken 20743579 times.
|
22267439 | if(flags&guy_invisible) |
| 6197 | 1523860 | return; | |
| 6198 |
3/8✓ Branch 0 taken 26258 times.
✓ Branch 1 taken 20717321 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 26258 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
20743579 | if(lensclk && (itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG6) && !(itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG7) && !(flags&lens_only)) |
| 6199 | ✗ | return; | |
| 6200 | |||
| 6201 | //We did the normal don't_draw stuff here so we can make exceptions; specifically the lens check (which should make enemies | ||
| 6202 | // be cloaked if they have "invisible displays as cloaked" checked. | ||
| 6203 | |||
| 6204 | 20743579 | byte canSee = DRAW_NORMAL; | |
| 6205 | //Enemy specific stuff | ||
| 6206 |
1/2✓ Branch 0 taken 20743579 times.
✗ Branch 1 not taken.
|
20743579 | if ( editorflags & ENEMY_FLAG1 ) |
| 6207 | { | ||
| 6208 | ✗ | canSee = DRAW_INVIS; | |
| 6209 | ✗ | if (editorflags & ENEMY_FLAG4) canSee = DRAW_CLOAKED; | |
| 6210 | ✗ | if (dmisc13 >= 0 && (editorflags & ENEMY_FLAG2)) | |
| 6211 | { | ||
| 6212 | ✗ | if (game->item[dmisc13]) | |
| 6213 | { | ||
| 6214 | ✗ | canSee = DRAW_NORMAL; | |
| 6215 | ✗ | } | |
| 6216 | //else if ( lensclk && getlensid.flags SHOWINVIS ) | ||
| 6217 | //{ | ||
| 6218 | // | ||
| 6219 | //} | ||
| 6220 | //else | ||
| 6221 | //{ | ||
| 6222 | // if ( (editorflags & ENEMY_FLAG4) ) canSee = DRAW_CLOAKED; | ||
| 6223 | // //otherwisem invisible | ||
| 6224 | //} | ||
| 6225 | ✗ | } | |
| 6226 | ✗ | } | |
| 6227 | //Room specific | ||
| 6228 |
2/2✓ Branch 0 taken 20552934 times.
✓ Branch 1 taken 190645 times.
|
20743579 | if (tmpscr->flags3&fINVISROOM) |
| 6229 | { | ||
| 6230 |
4/6✓ Branch 0 taken 190645 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32460 times.
✓ Branch 3 taken 158185 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 32460 times.
|
223105 | if (canSee == DRAW_NORMAL && !(current_item(itype_amulet)) && |
| 6231 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32460 times.
|
32460 | !((itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG5) && lensclk) && family!=eeGANON) canSee = DRAW_CLOAKED; |
| 6232 | 190645 | } | |
| 6233 | //Lens check | ||
| 6234 |
2/2✓ Branch 0 taken 26258 times.
✓ Branch 1 taken 20717321 times.
|
20743579 | if (lensclk) |
| 6235 | { | ||
| 6236 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 26258 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
26258 | if((itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG6) && !(flags&lens_only)) |
| 6237 | { | ||
| 6238 | ✗ | if (canSee == DRAW_NORMAL) | |
| 6239 | { | ||
| 6240 | ✗ | if (itemsbuf[Hero.getLastLensID()].flags & ITEM_FLAG7) canSee = DRAW_CLOAKED; | |
| 6241 | ✗ | else canSee = DRAW_INVIS; //Should never happen cause dont_draw should catch this, but just in case. | |
| 6242 | ✗ | } | |
| 6243 | ✗ | } | |
| 6244 |
2/2✓ Branch 0 taken 25826 times.
✓ Branch 1 taken 432 times.
|
26258 | if(flags&lens_only) |
| 6245 | { | ||
| 6246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 432 times.
|
432 | if (canSee == DRAW_INVIS) canSee = DRAW_NORMAL; |
| 6247 | 432 | } | |
| 6248 | 26258 | } | |
| 6249 | else | ||
| 6250 | { | ||
| 6251 |
2/2✓ Branch 0 taken 20643905 times.
✓ Branch 1 taken 73416 times.
|
20717321 | if(flags&lens_only) |
| 6252 | 73416 | canSee = DRAW_INVIS; | |
| 6253 | } | ||
| 6254 |
3/4✓ Branch 0 taken 73416 times.
✓ Branch 1 taken 20670163 times.
✓ Branch 2 taken 73416 times.
✗ Branch 3 not taken.
|
20743579 | if (canSee == DRAW_INVIS && (editorflags & ENEMY_FLAG4)) canSee = DRAW_CLOAKED; |
| 6255 |
3/4✓ Branch 0 taken 20637703 times.
✓ Branch 1 taken 105876 times.
✓ Branch 2 taken 20637703 times.
✗ Branch 3 not taken.
|
20743579 | if (canSee == DRAW_NORMAL && (editorflags & ENEMY_FLAG16)) canSee = DRAW_CLOAKED; |
| 6256 | |||
| 6257 |
2/2✓ Branch 0 taken 20670163 times.
✓ Branch 1 taken 73416 times.
|
20743579 | if (canSee == DRAW_INVIS) |
| 6258 | 73416 | return; | |
| 6259 | |||
| 6260 |
3/4✓ Branch 0 taken 20670021 times.
✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20670021 times.
|
20670163 | if(fallclk||drownclk) |
| 6261 | { | ||
| 6262 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
|
142 | if (canSee == DRAW_CLOAKED) |
| 6263 | { | ||
| 6264 | ✗ | sprite::drawcloaked(dest); | |
| 6265 | ✗ | } | |
| 6266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
|
142 | else if (canSee == DRAW_NORMAL) |
| 6267 | { | ||
| 6268 | 142 | sprite::draw(dest); | |
| 6269 | 142 | } | |
| 6270 | 142 | return; | |
| 6271 | } | ||
| 6272 | 20670021 | int32_t cshold=cs; | |
| 6273 | |||
| 6274 |
2/2✓ Branch 0 taken 471563 times.
✓ Branch 1 taken 20198458 times.
|
20670021 | if(dying) |
| 6275 | { | ||
| 6276 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 471563 times.
|
471563 | if(clk2>=19) |
| 6277 | { | ||
| 6278 | ✗ | if(!(clk2&2)) | |
| 6279 | { | ||
| 6280 | //if the enemy isn't totally invisible, or if it is, but Hero has the item needed to reveal it, draw it. | ||
| 6281 | ✗ | if (canSee == DRAW_CLOAKED) | |
| 6282 | { | ||
| 6283 | ✗ | sprite::drawcloaked(dest); | |
| 6284 | ✗ | } | |
| 6285 | ✗ | else if (canSee == DRAW_NORMAL) | |
| 6286 | { | ||
| 6287 | ✗ | sprite::draw(dest); | |
| 6288 | ✗ | } | |
| 6289 | ✗ | } | |
| 6290 | ✗ | return; | |
| 6291 | } | ||
| 6292 | |||
| 6293 | 471563 | flip = 0; | |
| 6294 | 471563 | tile = wpnsbuf[spr_death].tile; | |
| 6295 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 471563 times.
|
471563 | if ( do_animation ) |
| 6296 | { | ||
| 6297 | 471563 | int32_t offs = 0; | |
| 6298 |
2/2✓ Branch 0 taken 466756 times.
✓ Branch 1 taken 4807 times.
|
471563 | if(!get_bit(quest_rules,qr_HARDCODED_ENEMY_ANIMS)) |
| 6299 | { | ||
| 6300 |
2/2✓ Branch 0 taken 4568 times.
✓ Branch 1 taken 239 times.
|
4807 | if(clk2 > 2) |
| 6301 | { | ||
| 6302 | 239 | spr_death_anim_clk=0; | |
| 6303 | 239 | clk2=1; | |
| 6304 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 235 times.
|
239 | if(hp > -1000) |
| 6305 | 235 | death_sfx(); | |
| 6306 | 239 | } | |
| 6307 |
4/4✓ Branch 0 taken 4472 times.
✓ Branch 1 taken 335 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 4456 times.
|
4807 | if(clk2==1 && spr_death_anim_clk>-1) |
| 6308 | { | ||
| 6309 | 4456 | ++clk2; | |
| 6310 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4456 times.
|
4456 | spr_death_anim_frm=(spr_death_anim_clk/zc_max(wpnsbuf[spr_death].speed,1)); |
| 6311 |
1/2✓ Branch 0 taken 4456 times.
✗ Branch 1 not taken.
|
4456 | spr_death_anim_frm *= zc_max(1,txsz); |
| 6312 | 4456 | int32_t rows = TILEROW(tile+spr_death_anim_frm)-TILEROW(tile); | |
| 6313 |
2/2✓ Branch 0 taken 4382 times.
✓ Branch 1 taken 74 times.
|
4456 | spr_death_anim_frm += TILES_PER_ROW*(zc_min(0,tysz-1)*rows); |
| 6314 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 4456 times.
✓ Branch 2 taken 4456 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 239 times.
✓ Branch 5 taken 4217 times.
|
4456 | if(++spr_death_anim_clk >= (zc_max(wpnsbuf[spr_death].speed,1) * zc_max(wpnsbuf[spr_death].frames,1))) |
| 6315 | { | ||
| 6316 | 239 | spr_death_anim_clk=-1; | |
| 6317 | 239 | clk2=1; | |
| 6318 | 239 | } | |
| 6319 | 4456 | } | |
| 6320 | 4807 | tile += spr_death_anim_frm; | |
| 6321 | 4807 | } | |
| 6322 |
2/2✓ Branch 0 taken 19363 times.
✓ Branch 1 taken 447393 times.
|
466756 | else if(BSZ) |
| 6323 | { | ||
| 6324 |
2/2✓ Branch 0 taken 15226 times.
✓ Branch 1 taken 4137 times.
|
19363 | offs = zc_min((15-clk2)/3,4); |
| 6325 | 19363 | } | |
| 6326 |
4/4✓ Branch 0 taken 298304 times.
✓ Branch 1 taken 149089 times.
✓ Branch 2 taken 148991 times.
✓ Branch 3 taken 149313 times.
|
447393 | else if(clk2>6 && clk2<=12) |
| 6327 | { | ||
| 6328 | 149313 | offs = 1; | |
| 6329 | 149313 | } | |
| 6330 | |||
| 6331 |
2/2✓ Branch 0 taken 305669 times.
✓ Branch 1 taken 165894 times.
|
471563 | if(offs) |
| 6332 | { | ||
| 6333 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 165894 times.
|
165894 | offs *= zc_max(1,txsz); |
| 6334 | 165894 | int32_t rows = TILEROW(tile+offs)-TILEROW(tile); | |
| 6335 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 165846 times.
|
165894 | offs += TILES_PER_ROW*(zc_min(0,tysz-1)*rows); |
| 6336 | 165894 | } | |
| 6337 | 471563 | tile += offs; | |
| 6338 | 471563 | } | |
| 6339 | |||
| 6340 |
6/6✓ Branch 0 taken 466756 times.
✓ Branch 1 taken 4807 times.
✓ Branch 2 taken 447393 times.
✓ Branch 3 taken 19363 times.
✓ Branch 4 taken 129054 times.
✓ Branch 5 taken 318339 times.
|
471563 | if(!get_bit(quest_rules,qr_HARDCODED_ENEMY_ANIMS) || BSZ || fading==fade_blue_poof) |
| 6341 | 153224 | cs = wpnsbuf[spr_death].csets&15; | |
| 6342 | else | ||
| 6343 | 318339 | cs = (((clk2+5)>>1)&3)+6; | |
| 6344 | 471563 | } | |
| 6345 |
3/4✓ Branch 0 taken 629119 times.
✓ Branch 1 taken 19569339 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 629119 times.
|
20198458 | else if(hclk>0 && getCanFlicker()) |
| 6346 | { | ||
| 6347 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 629119 times.
|
629119 | if(family==eeGANON) |
| 6348 | ✗ | cs=(((hclk-1)>>1)&3)+6; | |
| 6349 |
4/4✓ Branch 0 taken 582229 times.
✓ Branch 1 taken 46890 times.
✓ Branch 2 taken 174018 times.
✓ Branch 3 taken 408211 times.
|
629119 | else if(hclk<33 && !get_bit(quest_rules,qr_ENEMIESFLICKER)) |
| 6350 | 408211 | cs=(((hclk-1)>>1)&3)+6; | |
| 6351 | 629119 | } | |
| 6352 | //draw every other frame for flickering enemies | ||
| 6353 |
8/10✓ Branch 0 taken 10327161 times.
✓ Branch 1 taken 10342860 times.
✓ Branch 2 taken 10327161 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 539804 times.
✓ Branch 5 taken 9787357 times.
✓ Branch 6 taken 137003 times.
✓ Branch 7 taken 402801 times.
✓ Branch 8 taken 137003 times.
✗ Branch 9 not taken.
|
20670021 | if((frame&1)==1 || !(family !=eeGANON && hclk>0 && get_bit(quest_rules,qr_ENEMIESFLICKER) && getCanFlicker())) |
| 6354 | { | ||
| 6355 |
2/2✓ Branch 0 taken 32289 times.
✓ Branch 1 taken 20500729 times.
|
20533018 | if (canSee == DRAW_CLOAKED) |
| 6356 | { | ||
| 6357 | 32289 | sprite::drawcloaked(dest); | |
| 6358 | 32289 | } | |
| 6359 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20500729 times.
|
20500729 | else if (canSee == DRAW_NORMAL) |
| 6360 | { | ||
| 6361 |
1/2✓ Branch 0 taken 20500729 times.
✗ Branch 1 not taken.
|
20500729 | if ( frozenclock < 0 ) |
| 6362 | { | ||
| 6363 | ✗ | if ( frozentile > 0 ) tile = frozentile; | |
| 6364 | ✗ | loadpalset(csBOSS,frozencset); | |
| 6365 | ✗ | } | |
| 6366 | 20500729 | sprite::draw(dest); | |
| 6367 | 20500729 | } | |
| 6368 | 20533018 | } | |
| 6369 | 20670021 | cs=cshold; | |
| 6370 | 22766187 | } | |
| 6371 | |||
| 6372 | //old zc bosses | ||
| 6373 | 21153810 | void enemy::drawzcboss(BITMAP *dest) | |
| 6374 | { | ||
| 6375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21153810 times.
|
21153810 | if(dont_draw()) |
| 6376 | ✗ | return; | |
| 6377 | |||
| 6378 | 21153810 | int32_t cshold=cs; | |
| 6379 | |||
| 6380 |
2/2✓ Branch 0 taken 432445 times.
✓ Branch 1 taken 20721365 times.
|
21153810 | if(dying) |
| 6381 | { | ||
| 6382 |
2/2✓ Branch 0 taken 2592 times.
✓ Branch 1 taken 429853 times.
|
432445 | if(clk2>=19) |
| 6383 | { | ||
| 6384 |
2/2✓ Branch 0 taken 1296 times.
✓ Branch 1 taken 1296 times.
|
2592 | if(!(clk2&2)) |
| 6385 | 1296 | sprite::drawzcboss(dest); | |
| 6386 | |||
| 6387 | 2592 | return; | |
| 6388 | } | ||
| 6389 | |||
| 6390 | 429853 | flip = 0; | |
| 6391 | 429853 | tile = wpnsbuf[spr_death].tile; | |
| 6392 | |||
| 6393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 429853 times.
|
429853 | if ( do_animation ) |
| 6394 | { | ||
| 6395 |
2/2✓ Branch 0 taken 427667 times.
✓ Branch 1 taken 2186 times.
|
429853 | if(!get_bit(quest_rules,qr_HARDCODED_ENEMY_ANIMS)) |
| 6396 | { | ||
| 6397 |
2/2✓ Branch 0 taken 2184 times.
✓ Branch 1 taken 2 times.
|
2186 | if(clk2 > 2) |
| 6398 | { | ||
| 6399 | 2 | spr_death_anim_clk=0; | |
| 6400 | 2 | clk2=1; | |
| 6401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(hp > -1000) |
| 6402 | 2 | death_sfx(); | |
| 6403 | 2 | } | |
| 6404 |
4/4✓ Branch 0 taken 93 times.
✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 91 times.
✓ Branch 3 taken 2 times.
|
2186 | if(clk2==1 && spr_death_anim_clk>-1) |
| 6405 | { | ||
| 6406 | 2 | ++clk2; | |
| 6407 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | spr_death_anim_frm=(spr_death_anim_clk/zc_max(wpnsbuf[spr_death].speed,1)); |
| 6408 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | spr_death_anim_frm *= zc_max(1,txsz); |
| 6409 | 2 | int32_t rows = TILEROW(tile+spr_death_anim_frm)-TILEROW(tile); | |
| 6410 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | spr_death_anim_frm += TILES_PER_ROW*(zc_min(0,tysz-1)*rows); |
| 6411 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | if(++spr_death_anim_clk >= (zc_max(wpnsbuf[spr_death].speed,1) * zc_max(wpnsbuf[spr_death].frames,1))) |
| 6412 | { | ||
| 6413 | ✗ | spr_death_anim_clk=-1; | |
| 6414 | ✗ | clk2=1; | |
| 6415 | ✗ | } | |
| 6416 | 2 | } | |
| 6417 | 2186 | tile += spr_death_anim_frm; | |
| 6418 | 2186 | } | |
| 6419 |
2/2✓ Branch 0 taken 19363 times.
✓ Branch 1 taken 408304 times.
|
427667 | else if(BSZ) |
| 6420 |
2/2✓ Branch 0 taken 15226 times.
✓ Branch 1 taken 4137 times.
|
19363 | tile += zc_min((15-clk2)/3,4); |
| 6421 |
4/4✓ Branch 0 taken 272130 times.
✓ Branch 1 taken 136174 times.
✓ Branch 2 taken 135930 times.
✓ Branch 3 taken 136200 times.
|
408304 | else if(clk2>6 && clk2<=12) |
| 6422 | 136200 | ++tile; | |
| 6423 | 429853 | } | |
| 6424 | |||
| 6425 |
6/6✓ Branch 0 taken 427667 times.
✓ Branch 1 taken 2186 times.
✓ Branch 2 taken 408304 times.
✓ Branch 3 taken 19363 times.
✓ Branch 4 taken 125904 times.
✓ Branch 5 taken 282400 times.
|
429853 | if(!get_bit(quest_rules,qr_HARDCODED_ENEMY_ANIMS) || BSZ || fading==fade_blue_poof) |
| 6426 | 147453 | cs = wpnsbuf[spr_death].csets&15; | |
| 6427 | else | ||
| 6428 | 282400 | cs = (((clk2+5)>>1)&3)+6; | |
| 6429 | 429853 | } | |
| 6430 |
2/2✓ Branch 0 taken 20092956 times.
✓ Branch 1 taken 628409 times.
|
20721365 | else if(hclk>0) |
| 6431 | { | ||
| 6432 |
2/2✓ Branch 0 taken 2592 times.
✓ Branch 1 taken 625817 times.
|
628409 | if(family==eeGANON) |
| 6433 | 2592 | cs=(((hclk-1)>>1)&3)+6; | |
| 6434 |
4/4✓ Branch 0 taken 584144 times.
✓ Branch 1 taken 41673 times.
✓ Branch 2 taken 110465 times.
✓ Branch 3 taken 473679 times.
|
625817 | else if(hclk<33 && !get_bit(quest_rules,qr_ENEMIESFLICKER)) |
| 6435 | 473679 | cs=(((hclk-1)>>1)&3)+6; | |
| 6436 | 628409 | } | |
| 6437 | |||
| 6438 |
2/4✓ Branch 0 taken 164652 times.
✓ Branch 1 taken 20986566 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21151218 | if((tmpscr->flags3&fINVISROOM) && |
| 6439 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 164652 times.
|
164652 | !(current_item(itype_amulet)) && |
| 6440 | ✗ | !(get_bit(quest_rules,qr_LENSSEESENEMIES) && | |
| 6441 | ✗ | lensclk) && family!=eeGANON) | |
| 6442 | { | ||
| 6443 | ✗ | sprite::drawcloaked(dest); | |
| 6444 | ✗ | } | |
| 6445 | else | ||
| 6446 | { | ||
| 6447 |
6/6✓ Branch 0 taken 21131402 times.
✓ Branch 1 taken 19816 times.
✓ Branch 2 taken 1031552 times.
✓ Branch 3 taken 20099850 times.
✓ Branch 4 taken 872047 times.
✓ Branch 5 taken 159505 times.
|
21151218 | if(family !=eeGANON && hclk>0 && get_bit(quest_rules,qr_ENEMIESFLICKER)) |
| 6448 | { | ||
| 6449 |
2/2✓ Branch 0 taken 15820 times.
✓ Branch 1 taken 143685 times.
|
159505 | if((frame&1)==1) |
| 6450 | 143685 | sprite::drawzcboss(dest); | |
| 6451 | 159505 | } | |
| 6452 | else | ||
| 6453 | 20991713 | sprite::drawzcboss(dest); | |
| 6454 | } | ||
| 6455 | |||
| 6456 | 21151218 | cs=cshold; | |
| 6457 | 21153810 | } | |
| 6458 | |||
| 6459 | |||
| 6460 | // similar to the overblock function--can do up to a 32x32 sprite | ||
| 6461 | //will this play nicely with scripttile, solely using the modifications in sprite::draw()? | ||
| 6462 | 129329 | void enemy::drawblock(BITMAP *dest,int32_t mask) | |
| 6463 | { | ||
| 6464 | 129329 | int32_t thold=tile; | |
| 6465 | 129329 | int32_t t1=tile; | |
| 6466 | 129329 | int32_t t2=tile+20; | |
| 6467 | 129329 | int32_t t3=tile+1; | |
| 6468 | 129329 | int32_t t4=tile+21; | |
| 6469 | |||
| 6470 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 129329 times.
|
129329 | switch(mask) |
| 6471 | { | ||
| 6472 | case 1: | ||
| 6473 | ✗ | enemy::drawzcboss(dest); | |
| 6474 | ✗ | break; | |
| 6475 | |||
| 6476 | case 3: | ||
| 6477 | ✗ | if(flip&2) | |
| 6478 | ✗ | zc_swap(t1,t2); | |
| 6479 | |||
| 6480 | ✗ | tile=t1; | |
| 6481 | ✗ | enemy::drawzcboss(dest); | |
| 6482 | ✗ | tile=t2; | |
| 6483 | ✗ | yofs+=16; | |
| 6484 | ✗ | enemy::drawzcboss(dest); | |
| 6485 | ✗ | yofs-=16; | |
| 6486 | ✗ | break; | |
| 6487 | |||
| 6488 | case 5: | ||
| 6489 | ✗ | t2=tile+1; | |
| 6490 | |||
| 6491 | ✗ | if(flip&1) | |
| 6492 | ✗ | zc_swap(t1,t2); | |
| 6493 | |||
| 6494 | ✗ | tile=t1; | |
| 6495 | ✗ | enemy::drawzcboss(dest); | |
| 6496 | ✗ | tile=t2; | |
| 6497 | ✗ | xofs+=16; | |
| 6498 | ✗ | enemy::drawzcboss(dest); | |
| 6499 | ✗ | xofs-=16; | |
| 6500 | ✗ | break; | |
| 6501 | |||
| 6502 | case 15: | ||
| 6503 |
2/2✓ Branch 0 taken 123216 times.
✓ Branch 1 taken 6113 times.
|
129329 | if(flip&1) |
| 6504 | { | ||
| 6505 | 6113 | zc_swap(t1,t3); | |
| 6506 | 6113 | zc_swap(t2,t4); | |
| 6507 | 6113 | } | |
| 6508 | |||
| 6509 |
1/2✓ Branch 0 taken 129329 times.
✗ Branch 1 not taken.
|
129329 | if(flip&2) |
| 6510 | { | ||
| 6511 | ✗ | zc_swap(t1,t2); | |
| 6512 | ✗ | zc_swap(t3,t4); | |
| 6513 | ✗ | } | |
| 6514 | |||
| 6515 | 129329 | tile=t1; | |
| 6516 | 129329 | enemy::drawzcboss(dest); | |
| 6517 | 129329 | tile=t2; | |
| 6518 | 129329 | yofs+=16; | |
| 6519 | 129329 | enemy::drawzcboss(dest); | |
| 6520 | 129329 | yofs-=16; | |
| 6521 | 129329 | tile=t3; | |
| 6522 | 129329 | xofs+=16; | |
| 6523 | 129329 | enemy::drawzcboss(dest); | |
| 6524 | 129329 | tile=t4; | |
| 6525 | 129329 | yofs+=16; | |
| 6526 | 129329 | enemy::drawzcboss(dest); | |
| 6527 | 129329 | xofs-=16; | |
| 6528 | 129329 | yofs-=16; | |
| 6529 | 129329 | break; | |
| 6530 | } | ||
| 6531 | |||
| 6532 | 129329 | tile=thold; | |
| 6533 | 129329 | } | |
| 6534 | |||
| 6535 | 4531771 | void enemy::drawshadow(BITMAP *dest, bool translucent) | |
| 6536 | { | ||
| 6537 |
4/4✓ Branch 0 taken 4174837 times.
✓ Branch 1 taken 356934 times.
✓ Branch 2 taken 419689 times.
✓ Branch 3 taken 3755148 times.
|
4531771 | if(dont_draw() || isSideViewGravity()) |
| 6538 | { | ||
| 6539 | 776623 | return; | |
| 6540 | } | ||
| 6541 | |||
| 6542 |
2/2✓ Branch 0 taken 63093 times.
✓ Branch 1 taken 3692055 times.
|
3755148 | if(dying) |
| 6543 | { | ||
| 6544 | 63093 | return; | |
| 6545 | } | ||
| 6546 | |||
| 6547 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 3692055 times.
✓ Branch 2 taken 145552 times.
✓ Branch 3 taken 3546503 times.
|
3692055 | if(((tmpscr->flags3&fINVISROOM)&& !(current_item(itype_amulet)))|| |
| 6548 | 3692055 | (darkroom)) | |
| 6549 | { | ||
| 6550 | 145552 | return; | |
| 6551 | } | ||
| 6552 | else | ||
| 6553 | { | ||
| 6554 |
4/4✓ Branch 0 taken 3408891 times.
✓ Branch 1 taken 137612 times.
✓ Branch 2 taken 3399809 times.
✓ Branch 3 taken 9082 times.
|
3546503 | if(enemycanfall(id, false) && shadowtile == 0) |
| 6555 | 9082 | shadowtile = wpnsbuf[spr_shadow].tile; | |
| 6556 | |||
| 6557 |
5/6✓ Branch 0 taken 2974453 times.
✓ Branch 1 taken 572050 times.
✓ Branch 2 taken 2974453 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2836841 times.
✓ Branch 5 taken 137612 times.
|
3546503 | if(z>0 || fakez>0 || !enemycanfall(id, false)) |
| 6558 | { | ||
| 6559 |
2/2✓ Branch 0 taken 116 times.
✓ Branch 1 taken 709546 times.
|
709662 | if(!shadow_overpit(this)) |
| 6560 | 709546 | sprite::drawshadow(dest,translucent); | |
| 6561 | 709662 | } | |
| 6562 | } | ||
| 6563 | 4531771 | } | |
| 6564 | |||
| 6565 | 80451 | void enemy::masked_draw(BITMAP *dest,int32_t mx,int32_t my,int32_t mw,int32_t mh) | |
| 6566 | { | ||
| 6567 | 80451 | BITMAP *sub=create_sub_bitmap(dest,mx,my,mw,mh); | |
| 6568 | |||
| 6569 |
1/2✓ Branch 0 taken 80451 times.
✗ Branch 1 not taken.
|
80451 | if(sub!=NULL) |
| 6570 | { | ||
| 6571 | 80451 | xofs-=mx; | |
| 6572 | 80451 | yofs-=my; | |
| 6573 | 80451 | enemy::draw(sub); | |
| 6574 | 80451 | xofs+=mx; | |
| 6575 | 80451 | yofs+=my; | |
| 6576 | 80451 | destroy_bitmap(sub); | |
| 6577 | 80451 | } | |
| 6578 | else | ||
| 6579 | ✗ | enemy::draw(dest); | |
| 6580 | 80451 | } | |
| 6581 | |||
| 6582 | // override hit detection to check for invicibility, stunned, etc | ||
| 6583 | 52704 | bool enemy::hit(sprite *s) | |
| 6584 | { | ||
| 6585 |
3/6✓ Branch 0 taken 52704 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52704 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 52704 times.
|
52704 | if(!(s->scriptcoldet&1) || s->fallclk || s->drownclk) return false; |
| 6586 | |||
| 6587 |
2/4✓ Branch 0 taken 52704 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52704 times.
✗ Branch 3 not taken.
|
52704 | return (dying || hclk>0) ? false : sprite::hit(s); |
| 6588 | 52704 | } | |
| 6589 | |||
| 6590 | 25312932 | bool enemy::hit(int32_t tx,int32_t ty,int32_t tz,int32_t txsz2,int32_t tysz2,int32_t tzsz2) | |
| 6591 | { | ||
| 6592 |
4/4✓ Branch 0 taken 24865861 times.
✓ Branch 1 taken 447071 times.
✓ Branch 2 taken 24169321 times.
✓ Branch 3 taken 696540 times.
|
25312932 | return (dying || hclk>0) ? false : sprite::hit(tx,ty,tz,txsz2,tysz2,tzsz2); |
| 6593 | } | ||
| 6594 | ✗ | bool enemy::hit(int32_t tx,int32_t ty,int32_t txsz2,int32_t tysz2) | |
| 6595 | { | ||
| 6596 | ✗ | return (dying || hclk>0) ? false : sprite::hit(tx,ty,txsz2,tysz2); | |
| 6597 | } | ||
| 6598 | |||
| 6599 | 6635680 | bool enemy::hit(weapon *w) | |
| 6600 | { | ||
| 6601 |
4/6✓ Branch 0 taken 6505972 times.
✓ Branch 1 taken 129708 times.
✓ Branch 2 taken 6505972 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6505972 times.
|
6635680 | if(!(w->scriptcoldet&1) || w->fallclk || w->drownclk) return false; |
| 6602 | |||
| 6603 |
4/4✓ Branch 0 taken 6309124 times.
✓ Branch 1 taken 196848 times.
✓ Branch 2 taken 6002148 times.
✓ Branch 3 taken 306976 times.
|
6505972 | return (dying || hclk>0) ? false : sprite::hit(w); |
| 6604 | 6635680 | } | |
| 6605 | |||
| 6606 | 5590502 | bool enemy::can_pitfall(bool checkspawning) | |
| 6607 | { | ||
| 6608 |
4/4✓ Branch 0 taken 5583711 times.
✓ Branch 1 taken 6791 times.
✓ Branch 2 taken 5580705 times.
✓ Branch 3 taken 9797 times.
|
5590502 | if((fading||isspawning)&&checkspawning) return false; //Don't fall during spawn. |
| 6609 |
2/2✓ Branch 0 taken 5573643 times.
✓ Branch 1 taken 7062 times.
|
5580705 | switch(guysbuf[id&0xFFF].family) |
| 6610 | { | ||
| 6611 | case eeAQUA: | ||
| 6612 | case eeDIG: | ||
| 6613 | case eeDONGO: | ||
| 6614 | case eeFAIRY: | ||
| 6615 | case eeGANON: | ||
| 6616 | case eeGHOMA: | ||
| 6617 | case eeGLEEOK: | ||
| 6618 | case eeGUY: | ||
| 6619 | case eeLANM: | ||
| 6620 | case eeMANHAN: | ||
| 6621 | case eeMOLD: | ||
| 6622 | case eeNONE: | ||
| 6623 | case eePATRA: | ||
| 6624 | case eeZORA: | ||
| 6625 | 7062 | return false; //Disallowed types | |
| 6626 | default: | ||
| 6627 | 5573643 | return true; | |
| 6628 | } | ||
| 6629 | 5590502 | } | |
| 6630 | //Handle death | ||
| 6631 | 19303706 | void enemy::try_death(bool force_kill) | |
| 6632 | { | ||
| 6633 |
8/8✓ Branch 0 taken 19291376 times.
✓ Branch 1 taken 12330 times.
✓ Branch 2 taken 19291374 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 20912 times.
✓ Branch 5 taken 19270462 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 20911 times.
|
19303706 | if(!dying && (force_kill || (hp<=0 && !immortal))) |
| 6634 | { | ||
| 6635 | 20913 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6636 | 20913 | ev.clear(); | |
| 6637 | 20913 | ev.push_back(10000); | |
| 6638 | 20913 | ev.push_back(getUID()); | |
| 6639 | |||
| 6640 | 20913 | throwGenScriptEvent(GENSCR_EVENT_ENEMY_DEATH); | |
| 6641 | 20913 | bool isSaved = !ev[0]; | |
| 6642 | 20913 | ev.clear(); | |
| 6643 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20913 times.
|
20913 | if(isSaved) return; |
| 6644 | |||
| 6645 |
4/4✓ Branch 0 taken 23 times.
✓ Branch 1 taken 20890 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 21 times.
|
20913 | if(itemguy && (hasitem&2)!=0) |
| 6646 | { | ||
| 6647 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 21 times.
|
45 | for(int32_t i=0; i<items.Count(); i++) |
| 6648 | { | ||
| 6649 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 21 times.
|
24 | if(((item*)items.spr(i))->pickup&ipENEMY) |
| 6650 | { | ||
| 6651 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if (!get_bit(quest_rules, qr_BROKEN_ITEM_CARRYING)) |
| 6652 | { | ||
| 6653 | ✗ | if (get_bit(quest_rules, qr_ENEMY_DROPS_USE_HITOFFSETS)) | |
| 6654 | { | ||
| 6655 | ✗ | items.spr(i)->x = x+hxofs+(hxsz/2)-8; | |
| 6656 | ✗ | items.spr(i)->y = y+hyofs+(hysz/2)-10-fakez; | |
| 6657 | ✗ | } | |
| 6658 | else | ||
| 6659 | { | ||
| 6660 | ✗ | if(extend >= 3) | |
| 6661 | { | ||
| 6662 | ✗ | items.spr(i)->x = x+(txsz-1)*8; | |
| 6663 | ✗ | items.spr(i)->y = y-2+(tysz-1)*8; | |
| 6664 | ✗ | } | |
| 6665 | else | ||
| 6666 | { | ||
| 6667 | ✗ | items.spr(i)->x = x; | |
| 6668 | ✗ | items.spr(i)->y = y - 2; | |
| 6669 | } | ||
| 6670 | } | ||
| 6671 | ✗ | items.spr(i)->z = z; | |
| 6672 | ✗ | items.spr(i)->fakez = fakez; | |
| 6673 | ✗ | } | |
| 6674 | else | ||
| 6675 | { | ||
| 6676 | 21 | items.spr(i)->x = x; | |
| 6677 | 21 | items.spr(i)->y = y - 2; | |
| 6678 | } | ||
| 6679 | 21 | } | |
| 6680 | 24 | } | |
| 6681 | 21 | } | |
| 6682 | |||
| 6683 | 20913 | dying=true; | |
| 6684 | |||
| 6685 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 20891 times.
|
20913 | if(fading==fade_flash_die) |
| 6686 | 22 | clk2=19+18*4; | |
| 6687 | else | ||
| 6688 | { | ||
| 6689 | 20891 | clk2 = BSZ ? 15 : 19; | |
| 6690 | |||
| 6691 |
2/2✓ Branch 0 taken 5405 times.
✓ Branch 1 taken 15486 times.
|
20891 | if(fading!=fade_blue_poof) |
| 6692 | 15486 | fading=0; | |
| 6693 | } | ||
| 6694 | |||
| 6695 |
2/2✓ Branch 0 taken 20890 times.
✓ Branch 1 taken 23 times.
|
20913 | if(itemguy) |
| 6696 | { | ||
| 6697 | 23 | hasitem&=~2; | |
| 6698 | 23 | item_set=0; | |
| 6699 | 23 | } | |
| 6700 | |||
| 6701 |
6/6✓ Branch 0 taken 20229 times.
✓ Branch 1 taken 684 times.
✓ Branch 2 taken 15999 times.
✓ Branch 3 taken 4230 times.
✓ Branch 4 taken 118 times.
✓ Branch 5 taken 15881 times.
|
20913 | if(currscr<128 && count_enemy && !script_spawned) |
| 6702 | 15881 | game->guys[(currmap<<7)+currscr]-=1; | |
| 6703 | 20913 | } | |
| 6704 | 19303706 | } | |
| 6705 | |||
| 6706 | // --==**==-- | ||
| 6707 | |||
| 6708 | // Movement routines that can be used by derived classes as needed | ||
| 6709 | |||
| 6710 | // --==**==-- | ||
| 6711 | |||
| 6712 | 304036 | void enemy::fix_coords(bool bound) | |
| 6713 | { | ||
| 6714 |
1/2✓ Branch 0 taken 304036 times.
✗ Branch 1 not taken.
|
304036 | if ((get_bit(quest_rules,qr_OUTOFBOUNDSENEMIES) ? 1 : 0) ^ ((editorflags&ENEMY_FLAG11)?1:0)) return; |
| 6715 |
1/2✓ Branch 0 taken 304036 times.
✗ Branch 1 not taken.
|
304036 | if(moveflags & FLAG_IGNORE_SCREENEDGE) bound = false; |
| 6716 | |||
| 6717 | |||
| 6718 |
2/2✓ Branch 0 taken 40585 times.
✓ Branch 1 taken 263451 times.
|
304036 | if(bound) |
| 6719 | { | ||
| 6720 |
1/2✓ Branch 0 taken 263451 times.
✗ Branch 1 not taken.
|
263451 | if ( ((unsigned)(id&0xFFF)) < MAXGUYS ) |
| 6721 | { | ||
| 6722 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 263451 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
263451 | x=vbound(x, 0, (( guysbuf[id].SIZEflags&guyflagOVERRIDE_TILE_WIDTH && !isflier(id) ) ? (256-((txsz-1)*16)) : 240)); |
| 6723 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 263451 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
263451 | y=vbound(y, 0,(( guysbuf[id].SIZEflags&guyflagOVERRIDE_TILE_HEIGHT && !isflier(id) ) ? (176-((txsz-1)*16)) : 160)); |
| 6724 | 263451 | } | |
| 6725 | else | ||
| 6726 | { | ||
| 6727 | ✗ | x=vbound(x, 0,240); | |
| 6728 | ✗ | y=vbound(y, 0,160); | |
| 6729 | } | ||
| 6730 | 263451 | } | |
| 6731 | |||
| 6732 |
6/10✓ Branch 0 taken 302521 times.
✓ Branch 1 taken 1515 times.
✓ Branch 2 taken 304036 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 304036 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 304036 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 304036 times.
|
304036 | if(!OUTOFBOUNDS) |
| 6733 | { | ||
| 6734 | /*x=((int32_t(x)&0xF0)+((int32_t(x)&8)?16:0)); | ||
| 6735 | |||
| 6736 | if(isSideViewGravity()) | ||
| 6737 | y=((int32_t(y)&0xF8)+((int32_t(y)&4)?8:0)); | ||
| 6738 | else | ||
| 6739 | y=((int32_t(y)&0xF0)+((int32_t(y)&8)?16:0)); | ||
| 6740 | */ | ||
| 6741 | 304036 | do_fix(x, 16, true); | |
| 6742 |
2/2✓ Branch 0 taken 1515 times.
✓ Branch 1 taken 302521 times.
|
304036 | if(isSideViewGravity()) |
| 6743 | 1515 | do_fix(y,8,true); | |
| 6744 | 302521 | else do_fix(y,16,true); | |
| 6745 | 304036 | } | |
| 6746 | 304036 | } | |
| 6747 | 5964 | bool enemy::cannotpenetrate() | |
| 6748 | { | ||
| 6749 |
4/4✓ Branch 0 taken 5850 times.
✓ Branch 1 taken 114 times.
✓ Branch 2 taken 19 times.
✓ Branch 3 taken 5831 times.
|
5964 | return (family == eeAQUA || family == eeMANHAN || family == eeGHOMA); |
| 6750 | } | ||
| 6751 | |||
| 6752 | 375 | bool enemy::canmove_old(int32_t ndir,zfix s,int32_t special,int32_t dx1,int32_t dy1,int32_t dx2,int32_t dy2) | |
| 6753 | { | ||
| 6754 | bool ok; | ||
| 6755 | 375 | int32_t dx = 0, dy = 0; | |
| 6756 | 375 | int32_t sv = 8; | |
| 6757 | |||
| 6758 | //Why is this here??? Why is it needed??? | ||
| 6759 | 375 | s += 0.5; // Make the ints round; doesn't seem to cause any problems. | |
| 6760 | |||
| 6761 |
8/9✓ Branch 0 taken 43 times.
✓ Branch 1 taken 37 times.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 49 times.
✓ Branch 4 taken 65 times.
✓ Branch 5 taken 56 times.
✓ Branch 6 taken 42 times.
✓ Branch 7 taken 53 times.
✗ Branch 8 not taken.
|
375 | switch(ndir) |
| 6762 | { | ||
| 6763 | case 8: | ||
| 6764 | case up: | ||
| 6765 |
3/4✓ Branch 0 taken 26 times.
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
|
43 | if(canfall(id) && isSideViewGravity()) |
| 6766 | ✗ | return false; | |
| 6767 | |||
| 6768 | 43 | dy = dy1-s; | |
| 6769 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
43 | special = (special==spw_clipbottomright)?spw_none:special; |
| 6770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
|
43 | ok = !m_walkflag_old(x,y+dy,special, x, y) && !flyerblocked(x,y+dy, special); |
| 6771 | 43 | break; | |
| 6772 | |||
| 6773 | case 12: | ||
| 6774 | case down: | ||
| 6775 |
3/4✓ Branch 0 taken 22 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
|
37 | if(canfall(id) && isSideViewGravity()) |
| 6776 | ✗ | return false; | |
| 6777 | |||
| 6778 | 37 | dy = dy2+s; | |
| 6779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 37 times.
|
37 | ok = !m_walkflag_old(x,y+dy,special, x, y) && !flyerblocked(x,y+dy, special); |
| 6780 | 37 | break; | |
| 6781 | |||
| 6782 | case 14: | ||
| 6783 | case left: | ||
| 6784 | 30 | dx = dx1-s; | |
| 6785 | 30 | sv = ((isSideViewGravity())?7:8); | |
| 6786 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
|
30 | special = (special==spw_clipbottomright||special==spw_clipright)?spw_none:special; |
| 6787 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 29 times.
|
30 | ok = !m_walkflag_old(x+dx,y+sv,special, x, y) && !flyerblocked(x+dx,y+8, special); |
| 6788 | 30 | break; | |
| 6789 | |||
| 6790 | case 10: | ||
| 6791 | case right: | ||
| 6792 | 49 | dx = dx2+s; | |
| 6793 | 49 | sv = ((isSideViewGravity())?7:8); | |
| 6794 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 45 times.
|
49 | ok = !m_walkflag_old(x+dx,y+sv,special, x, y) && !flyerblocked(x+dx,y+8, special); |
| 6795 | 49 | break; | |
| 6796 | |||
| 6797 | case 9: | ||
| 6798 | case r_up: | ||
| 6799 | 65 | dx = dx2+s; | |
| 6800 | 65 | dy = dy1-s; | |
| 6801 |
3/4✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
✓ Branch 3 taken 1 times.
|
129 | ok = !m_walkflag_old(x,y+dy,special, x, y) && !m_walkflag_old(x+dx,y+sv,special, x, y) && |
| 6802 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | !flyerblocked(x,y+dy, special) && !flyerblocked(x+dx,y+8, special); |
| 6803 | 65 | break; | |
| 6804 | |||
| 6805 | case 11: | ||
| 6806 | case r_down: | ||
| 6807 | 56 | dx = dx2+s; | |
| 6808 | 56 | dx = dy2+s; | |
| 6809 |
2/4✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 56 times.
✗ Branch 3 not taken.
|
112 | ok = !m_walkflag_old(x,y+dy,special, x, y) && !m_walkflag_old(x+dx,y+sv,special, x, y) && |
| 6810 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
56 | !flyerblocked(x,y+dy, special) && !flyerblocked(x+dx,y+8, special); |
| 6811 | 56 | break; | |
| 6812 | |||
| 6813 | case 13: | ||
| 6814 | case l_down: | ||
| 6815 | 42 | dx = dx1-s; | |
| 6816 | 42 | dy = dy2+s; | |
| 6817 |
3/4✓ Branch 0 taken 40 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
|
82 | ok = !m_walkflag_old(x,y+dy,special, x, y) && !m_walkflag_old(x+dx,y+sv,special, x, y) && |
| 6818 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | !flyerblocked(x,y+dy, special) && !flyerblocked(x+dx,y+8, special); |
| 6819 | 42 | break; | |
| 6820 | |||
| 6821 | case 15: | ||
| 6822 | case l_up: | ||
| 6823 | 53 | dx = dx1-s; | |
| 6824 | 53 | dy = dy1-s; | |
| 6825 |
2/4✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✗ Branch 3 not taken.
|
106 | ok = !m_walkflag_old(x,y+dy,special, x, y) && !m_walkflag_old(x+dx,y+sv,special, x, y) && |
| 6826 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
|
53 | !flyerblocked(x,y+dy, special) && !flyerblocked(x+dx,y+8, special); |
| 6827 | 53 | break; | |
| 6828 | |||
| 6829 | default: | ||
| 6830 | ✗ | db=99; | |
| 6831 | ✗ | return true; | |
| 6832 | } | ||
| 6833 | |||
| 6834 | 375 | return ok; | |
| 6835 | 375 | } | |
| 6836 | |||
| 6837 | |||
| 6838 | |||
| 6839 | |||
| 6840 | // returns true if next step is ok, false if there is something there | ||
| 6841 | 3495563 | bool enemy::canmove(int32_t ndir,zfix s,int32_t special,int32_t dx1,int32_t dy1,int32_t dx2,int32_t dy2, bool kb) | |
| 6842 | { | ||
| 6843 | 3495563 | bool ok = false; //initialise the var, son't just declare it | |
| 6844 | 3495563 | int32_t dx = 0, dy = 0; | |
| 6845 | 3495563 | int32_t sv = 8; | |
| 6846 | 3495563 | int32_t tries = 2; int32_t try_x = 0; int32_t try_y = 0; | |
| 6847 | //Why is this here??? Why is it needed??? | ||
| 6848 | 3495563 | s += 0.5; // Make the ints round; doesn't seem to cause any problems. | |
| 6849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3495563 times.
|
3495563 | int32_t usexoffs = (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) ? hxofs : 0; |
| 6850 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3495563 times.
|
3495563 | int32_t useyoffs = (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) ? hyofs : 0; |
| 6851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3495563 times.
|
3495563 | int32_t usewid = (SIZEflags&guyflagOVERRIDE_HIT_WIDTH) ? hxsz : 16; |
| 6852 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3495563 times.
|
3495563 | int32_t usehei = (SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) ? hysz : 16; |
| 6853 | 3495563 | bool offgrid = OFFGRID_ENEMY; | |
| 6854 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3495563 times.
|
3495563 | if(!offgrid) |
| 6855 | { | ||
| 6856 | //Enemies smaller than 1-tile must act as 1-tile large, if off-grid movement is disabled. | ||
| 6857 |
1/2✓ Branch 0 taken 3495563 times.
✗ Branch 1 not taken.
|
3495563 | if(usehei<16)usehei=16; |
| 6858 |
1/2✓ Branch 0 taken 3495563 times.
✗ Branch 1 not taken.
|
3495563 | if(usewid<16)usewid=16; |
| 6859 | 3495563 | } | |
| 6860 |
9/9✓ Branch 0 taken 646476 times.
✓ Branch 1 taken 518798 times.
✓ Branch 2 taken 580898 times.
✓ Branch 3 taken 586816 times.
✓ Branch 4 taken 264971 times.
✓ Branch 5 taken 320258 times.
✓ Branch 6 taken 295401 times.
✓ Branch 7 taken 280852 times.
✓ Branch 8 taken 1093 times.
|
3495563 | switch(ndir) //need to check every 8 pixels between two points |
| 6861 | { | ||
| 6862 | case 8: | ||
| 6863 | case up: | ||
| 6864 | { | ||
| 6865 |
4/4✓ Branch 0 taken 96071 times.
✓ Branch 1 taken 550405 times.
✓ Branch 2 taken 95345 times.
✓ Branch 3 taken 726 times.
|
646476 | if(enemycanfall(id) && isSideViewGravity()) |
| 6866 | 726 | return false; | |
| 6867 | |||
| 6868 | 645750 | dy = dy1-s; | |
| 6869 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 645747 times.
|
645750 | special = (special==spw_clipbottomright)?spw_none:special; |
| 6870 | 645750 | tries = usewid/(offgrid ? 8 : 16); | |
| 6871 | //Z_eventlog("Trying move UP, dy=%d,usewid=%d,usehei=%d\n",int32_t(dy),usewid,usehei); | ||
| 6872 |
2/2✓ Branch 0 taken 553637 times.
✓ Branch 1 taken 645750 times.
|
1199387 | for ( ; tries > 0; --tries ) |
| 6873 | { | ||
| 6874 |
2/2✓ Branch 0 taken 90449 times.
✓ Branch 1 taken 555301 times.
|
645750 | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy,special, ndir, x+usexoffs+try_x, y+useyoffs, kb) && !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy, special,kb); |
| 6875 | 645750 | try_x += (offgrid ? 8 : 16); | |
| 6876 |
2/2✓ Branch 0 taken 553637 times.
✓ Branch 1 taken 92113 times.
|
645750 | if (!ok) break; |
| 6877 | 553637 | } | |
| 6878 |
2/2✓ Branch 0 taken 553637 times.
✓ Branch 1 taken 92113 times.
|
645750 | if(!ok) break; |
| 6879 |
1/2✓ Branch 0 taken 553637 times.
✗ Branch 1 not taken.
|
553637 | if((usewid%16)>0) //Uneven width |
| 6880 | { | ||
| 6881 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy,special, ndir, x+usexoffs+usewid-1, y+useyoffs, kb) && !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy, special,kb); | |
| 6882 | ✗ | } | |
| 6883 | 553637 | break; | |
| 6884 | } | ||
| 6885 | case 12: | ||
| 6886 | case down: | ||
| 6887 | { | ||
| 6888 |
4/4✓ Branch 0 taken 106704 times.
✓ Branch 1 taken 412094 times.
✓ Branch 2 taken 105898 times.
✓ Branch 3 taken 806 times.
|
518798 | if(enemycanfall(id) && isSideViewGravity()) |
| 6889 | 806 | return false; | |
| 6890 | |||
| 6891 | 517992 | dy = dy2+s; | |
| 6892 | 517992 | tries = usewid/(offgrid ? 8 : 16); | |
| 6893 | //Z_eventlog("Trying move DOWN, dy=%d,usewid=%d,usehei=%d\n",int32_t(dy),usewid,usehei); | ||
| 6894 |
2/2✓ Branch 0 taken 422309 times.
✓ Branch 1 taken 517992 times.
|
940301 | for ( ; tries > 0; --tries ) |
| 6895 | { | ||
| 6896 |
3/4✓ Branch 0 taken 95461 times.
✓ Branch 1 taken 422531 times.
✓ Branch 2 taken 422531 times.
✗ Branch 3 not taken.
|
517992 | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy,special, ndir, x+usexoffs+try_x, y+useyoffs, kb) && !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+zc_max(usehei-16,0), special,kb); |
| 6897 | 517992 | try_x += (offgrid ? 8 : 16); | |
| 6898 |
2/2✓ Branch 0 taken 422309 times.
✓ Branch 1 taken 95683 times.
|
517992 | if (!ok) break; |
| 6899 | 422309 | } | |
| 6900 |
2/2✓ Branch 0 taken 422309 times.
✓ Branch 1 taken 95683 times.
|
517992 | if(!ok) break; |
| 6901 |
1/2✓ Branch 0 taken 422309 times.
✗ Branch 1 not taken.
|
422309 | if((usewid%16)>0) //Uneven width |
| 6902 | { | ||
| 6903 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy,special, ndir, x+usexoffs+usewid-1, y+useyoffs, kb) && !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+zc_max(usehei-16,0), special,kb); | |
| 6904 | ✗ | } | |
| 6905 | 422309 | break; | |
| 6906 | } | ||
| 6907 | case 14: | ||
| 6908 | case left: | ||
| 6909 | { | ||
| 6910 | 580898 | dx = dx1-s; | |
| 6911 | 580898 | sv = ((isSideViewGravity())?7:0); | |
| 6912 |
4/4✓ Branch 0 taken 580892 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 1251 times.
✓ Branch 3 taken 579641 times.
|
580898 | special = (special==spw_clipbottomright||special==spw_clipright)?spw_none:special; |
| 6913 | 580898 | tries = usehei/(offgrid ? 8 : 16); | |
| 6914 | //Z_eventlog("Trying move LEFT, dx=%d,usewid=%d,usehei=%d\n",int32_t(dx),usewid,usehei); | ||
| 6915 |
2/2✓ Branch 0 taken 491525 times.
✓ Branch 1 taken 580898 times.
|
1072423 | for ( ; tries > 0; --tries ) |
| 6916 | { | ||
| 6917 |
2/2✓ Branch 0 taken 88799 times.
✓ Branch 1 taken 492099 times.
|
580898 | ok = !m_walkflag(x+usexoffs+dx,y+useyoffs+try_y+sv,special, ndir, x+usexoffs, y+useyoffs+try_y, kb) && !flyerblocked(x+usexoffs+dx,y+8+useyoffs+try_y, special,kb); |
| 6918 | 580898 | try_y += (offgrid ? 8 : 16); | |
| 6919 |
2/2✓ Branch 0 taken 491525 times.
✓ Branch 1 taken 89373 times.
|
580898 | if (!ok) break; |
| 6920 | 491525 | } | |
| 6921 |
2/2✓ Branch 0 taken 491525 times.
✓ Branch 1 taken 89373 times.
|
580898 | if(!ok) break; |
| 6922 |
1/2✓ Branch 0 taken 491525 times.
✗ Branch 1 not taken.
|
491525 | if((usehei%16)>0) //Uneven height |
| 6923 | { | ||
| 6924 | ✗ | ok = !m_walkflag(x+usexoffs+dx,y+useyoffs+usehei-1+sv,special, ndir, x+usexoffs, y+useyoffs+usehei-1, kb) && !flyerblocked(x+usexoffs+dx,y+8+useyoffs+usehei-1, special,kb); | |
| 6925 | ✗ | } | |
| 6926 | 491525 | break; | |
| 6927 | } | ||
| 6928 | case 10: | ||
| 6929 | case right: | ||
| 6930 | { | ||
| 6931 | 586816 | dx = dx2+s; | |
| 6932 | 586816 | sv = ((isSideViewGravity())?7:0); | |
| 6933 | 586816 | tries = usehei/(offgrid ? 8 : 16); | |
| 6934 | //Z_eventlog("Trying move RIGHT, dx=%d,usewid=%d,usehei=%d\n",int32_t(dx),usewid,usehei); | ||
| 6935 |
2/2✓ Branch 0 taken 499807 times.
✓ Branch 1 taken 586816 times.
|
1086623 | for ( ; tries > 0; --tries ) |
| 6936 | { | ||
| 6937 |
3/4✓ Branch 0 taken 86437 times.
✓ Branch 1 taken 500379 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 500379 times.
|
586816 | ok = !m_walkflag(x+usexoffs+dx,y+useyoffs+try_y+sv,special, ndir, x+usexoffs, y+useyoffs+try_y, kb) && !flyerblocked(x+usexoffs+dx+zc_max(usewid-16,0),y+8+useyoffs+try_y, special,kb); |
| 6938 | 586816 | try_y += (offgrid ? 8 : 16); | |
| 6939 |
2/2✓ Branch 0 taken 499807 times.
✓ Branch 1 taken 87009 times.
|
586816 | if (!ok) break; |
| 6940 | 499807 | } | |
| 6941 |
2/2✓ Branch 0 taken 499807 times.
✓ Branch 1 taken 87009 times.
|
586816 | if(!ok) break; |
| 6942 |
1/2✓ Branch 0 taken 499807 times.
✗ Branch 1 not taken.
|
499807 | if((usehei%16)>0) //Uneven height |
| 6943 | { | ||
| 6944 | ✗ | ok = !m_walkflag(x+usexoffs+dx,y+useyoffs+usehei-1+sv,special, ndir, x+usexoffs, y+useyoffs+usehei-1, kb) && !flyerblocked(x+usexoffs+dx+zc_max(usewid-16,0),y+8+useyoffs+usehei-1, special,kb); | |
| 6945 | ✗ | } | |
| 6946 | 499807 | break; | |
| 6947 | } | ||
| 6948 | case 9: | ||
| 6949 | case r_up: | ||
| 6950 | { | ||
| 6951 | 264971 | dx = dx2+s; | |
| 6952 | 264971 | dy = dy1-s; | |
| 6953 | 264971 | int32_t tries_x = usewid/(offgrid ? 8 : 16); | |
| 6954 | 264971 | sv = ((isSideViewGravity())?7:0); | |
| 6955 |
2/2✓ Branch 0 taken 256302 times.
✓ Branch 1 taken 264971 times.
|
521273 | for ( ; tries_x > 0; --tries_x ) |
| 6956 | { | ||
| 6957 | 264971 | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 6958 | 264971 | try_y = 0; | |
| 6959 |
2/2✓ Branch 0 taken 256302 times.
✓ Branch 1 taken 264971 times.
|
521273 | for ( ; tries_y > 0; --tries_y ) |
| 6960 | { | ||
| 6961 |
4/4✓ Branch 0 taken 261306 times.
✓ Branch 1 taken 3665 times.
✓ Branch 2 taken 258460 times.
✓ Branch 3 taken 2846 times.
|
523431 | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && |
| 6962 |
2/2✓ Branch 0 taken 1599 times.
✓ Branch 1 taken 256861 times.
|
258460 | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+try_y, special,kb); |
| 6963 | 264971 | try_y += (offgrid ? 8 : 16); | |
| 6964 |
2/2✓ Branch 0 taken 256302 times.
✓ Branch 1 taken 8669 times.
|
264971 | if (!ok) break; |
| 6965 | 256302 | } | |
| 6966 |
2/2✓ Branch 0 taken 256302 times.
✓ Branch 1 taken 8669 times.
|
264971 | if (!ok) break; |
| 6967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 256302 times.
|
256302 | if((usehei%16)>0) //Uneven height |
| 6968 | { | ||
| 6969 | ✗ | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && | |
| 6970 | ✗ | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+usehei-1, special,kb); | |
| 6971 | ✗ | } | |
| 6972 | 256302 | try_x += (offgrid ? 8 : 16); | |
| 6973 | 256302 | } | |
| 6974 |
2/2✓ Branch 0 taken 256302 times.
✓ Branch 1 taken 8669 times.
|
264971 | if(!ok) break; |
| 6975 |
1/2✓ Branch 0 taken 256302 times.
✗ Branch 1 not taken.
|
256302 | if((usewid%16)>0) //Uneven width |
| 6976 | { | ||
| 6977 | ✗ | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 6978 | ✗ | try_y = 0; | |
| 6979 | ✗ | for ( ; tries_y > 0; --tries_y ) | |
| 6980 | { | ||
| 6981 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && | |
| 6982 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+try_y, special,kb); | |
| 6983 | ✗ | try_y += (offgrid ? 8 : 16); | |
| 6984 | ✗ | if (!ok) break; | |
| 6985 | ✗ | } | |
| 6986 | ✗ | if (!ok) break; | |
| 6987 | ✗ | if((usehei%16)>0) //Uneven height | |
| 6988 | { | ||
| 6989 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && | |
| 6990 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+usehei-1, special,kb); | |
| 6991 | ✗ | } | |
| 6992 | ✗ | } | |
| 6993 | 256302 | break; | |
| 6994 | } | ||
| 6995 | case 11: | ||
| 6996 | case r_down: | ||
| 6997 | { | ||
| 6998 | 320258 | dx = dx2+s; | |
| 6999 | 320258 | dx = dy2+s; | |
| 7000 | 320258 | int32_t tries_x = usewid/(offgrid ? 8 : 16); | |
| 7001 | //sv = ((isSideViewGravity())?7:0); | ||
| 7002 |
2/2✓ Branch 0 taken 313037 times.
✓ Branch 1 taken 320258 times.
|
633295 | for ( ; tries_x > 0; --tries_x ) |
| 7003 | { | ||
| 7004 | 320258 | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 7005 | 320258 | try_y = 0; | |
| 7006 |
2/2✓ Branch 0 taken 313037 times.
✓ Branch 1 taken 320258 times.
|
633295 | for ( ; tries_y > 0; --tries_y ) |
| 7007 | { | ||
| 7008 |
4/4✓ Branch 0 taken 320126 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 313298 times.
✓ Branch 3 taken 6828 times.
|
633556 | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && |
| 7009 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 313260 times.
|
313298 | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+try_y, special,kb); |
| 7010 | 320258 | try_y += (offgrid ? 8 : 16); | |
| 7011 |
2/2✓ Branch 0 taken 313037 times.
✓ Branch 1 taken 7221 times.
|
320258 | if (!ok) break; |
| 7012 | 313037 | } | |
| 7013 |
2/2✓ Branch 0 taken 313037 times.
✓ Branch 1 taken 7221 times.
|
320258 | if (!ok) break; |
| 7014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 313037 times.
|
313037 | if((usehei%16)>0) //Uneven height |
| 7015 | { | ||
| 7016 | ✗ | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && | |
| 7017 | ✗ | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+usehei-1, special,kb); | |
| 7018 | ✗ | } | |
| 7019 | 313037 | try_x += (offgrid ? 8 : 16); | |
| 7020 | 313037 | } | |
| 7021 |
2/2✓ Branch 0 taken 313037 times.
✓ Branch 1 taken 7221 times.
|
320258 | if(!ok) break; |
| 7022 |
1/2✓ Branch 0 taken 313037 times.
✗ Branch 1 not taken.
|
313037 | if((usewid%16)>0) //Uneven width |
| 7023 | { | ||
| 7024 | ✗ | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 7025 | ✗ | try_y = 0; | |
| 7026 | ✗ | for ( ; tries_y > 0; --tries_y ) | |
| 7027 | { | ||
| 7028 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && | |
| 7029 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+try_y, special,kb); | |
| 7030 | ✗ | try_y += (offgrid ? 8 : 16); | |
| 7031 | ✗ | if (!ok) break; | |
| 7032 | ✗ | } | |
| 7033 | ✗ | if (!ok) break; | |
| 7034 | ✗ | if((usehei%16)>0) //Uneven height | |
| 7035 | { | ||
| 7036 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && | |
| 7037 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+usehei-1, special,kb); | |
| 7038 | ✗ | } | |
| 7039 | ✗ | } | |
| 7040 | 313037 | break; | |
| 7041 | } | ||
| 7042 | case 13: | ||
| 7043 | case l_down: | ||
| 7044 | { | ||
| 7045 | 295401 | dx = dx1-s; | |
| 7046 | 295401 | dy = dy2+s; | |
| 7047 | 295401 | int32_t tries_x = usewid/(offgrid ? 8 : 16); | |
| 7048 | //sv = ((isSideViewGravity())?7:0); | ||
| 7049 |
2/2✓ Branch 0 taken 287977 times.
✓ Branch 1 taken 295401 times.
|
583378 | for ( ; tries_x > 0; --tries_x ) |
| 7050 | { | ||
| 7051 | 295401 | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 7052 | 295401 | try_y = 0; | |
| 7053 |
2/2✓ Branch 0 taken 287977 times.
✓ Branch 1 taken 295401 times.
|
583378 | for ( ; tries_y > 0; --tries_y ) |
| 7054 | { | ||
| 7055 |
4/4✓ Branch 0 taken 290465 times.
✓ Branch 1 taken 4936 times.
✓ Branch 2 taken 288231 times.
✓ Branch 3 taken 2234 times.
|
583632 | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && |
| 7056 |
2/2✓ Branch 0 taken 171 times.
✓ Branch 1 taken 288060 times.
|
288231 | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+try_y, special,kb); |
| 7057 | 295401 | try_y += (offgrid ? 8 : 16); | |
| 7058 |
2/2✓ Branch 0 taken 287977 times.
✓ Branch 1 taken 7424 times.
|
295401 | if (!ok) break; |
| 7059 | 287977 | } | |
| 7060 |
2/2✓ Branch 0 taken 287977 times.
✓ Branch 1 taken 7424 times.
|
295401 | if (!ok) break; |
| 7061 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 287977 times.
|
287977 | if((usehei%16)>0) //Uneven height |
| 7062 | { | ||
| 7063 | ✗ | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && | |
| 7064 | ✗ | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+usehei-1, special,kb); | |
| 7065 | ✗ | } | |
| 7066 | 287977 | try_x += (offgrid ? 8 : 16); | |
| 7067 | 287977 | } | |
| 7068 |
2/2✓ Branch 0 taken 287977 times.
✓ Branch 1 taken 7424 times.
|
295401 | if(!ok) break; |
| 7069 |
1/2✓ Branch 0 taken 287977 times.
✗ Branch 1 not taken.
|
287977 | if((usewid%16)>0) //Uneven width |
| 7070 | { | ||
| 7071 | ✗ | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 7072 | ✗ | try_y = 0; | |
| 7073 | ✗ | for ( ; tries_y > 0; --tries_y ) | |
| 7074 | { | ||
| 7075 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && | |
| 7076 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+try_y, special,kb); | |
| 7077 | ✗ | try_y += (offgrid ? 8 : 16); | |
| 7078 | ✗ | if (!ok) break; | |
| 7079 | ✗ | } | |
| 7080 | ✗ | if (!ok) break; | |
| 7081 | ✗ | if((usehei%16)>0) //Uneven height | |
| 7082 | { | ||
| 7083 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && | |
| 7084 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+usehei-1, special,kb); | |
| 7085 | ✗ | } | |
| 7086 | ✗ | } | |
| 7087 | 287977 | break; | |
| 7088 | } | ||
| 7089 | case 15: | ||
| 7090 | case l_up: | ||
| 7091 | { | ||
| 7092 | 280852 | dx = dx1-s; | |
| 7093 | 280852 | dy = dy1-s; | |
| 7094 | 280852 | int32_t tries_x = usewid/(offgrid ? 8 : 16); | |
| 7095 | 280852 | sv = ((isSideViewGravity())?7:0); | |
| 7096 |
2/2✓ Branch 0 taken 272641 times.
✓ Branch 1 taken 280852 times.
|
553493 | for ( ; tries_x > 0; --tries_x ) |
| 7097 | { | ||
| 7098 | 280852 | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 7099 | 280852 | try_y = 0; | |
| 7100 |
2/2✓ Branch 0 taken 272641 times.
✓ Branch 1 taken 280852 times.
|
553493 | for ( ; tries_y > 0; --tries_y ) |
| 7101 | { | ||
| 7102 |
4/4✓ Branch 0 taken 276998 times.
✓ Branch 1 taken 3854 times.
✓ Branch 2 taken 274921 times.
✓ Branch 3 taken 2077 times.
|
555773 | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+try_x, y+useyoffs+try_y, kb) && |
| 7103 |
2/2✓ Branch 0 taken 1714 times.
✓ Branch 1 taken 273207 times.
|
274921 | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+try_y, special,kb); |
| 7104 | 280852 | try_y += (offgrid ? 8 : 16); | |
| 7105 |
2/2✓ Branch 0 taken 272641 times.
✓ Branch 1 taken 8211 times.
|
280852 | if (!ok) break; |
| 7106 | 272641 | } | |
| 7107 |
2/2✓ Branch 0 taken 272641 times.
✓ Branch 1 taken 8211 times.
|
280852 | if (!ok) break; |
| 7108 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272641 times.
|
272641 | if((usehei%16)>0) //Uneven height |
| 7109 | { | ||
| 7110 | ✗ | ok = !m_walkflag(x+usexoffs+try_x,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+try_x,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+try_x, y+useyoffs+usehei-1, kb) && | |
| 7111 | ✗ | !flyerblocked(x+usexoffs+try_x,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+try_x,y+useyoffs+8+usehei-1, special,kb); | |
| 7112 | ✗ | } | |
| 7113 | 272641 | try_x += (offgrid ? 8 : 16); | |
| 7114 | 272641 | } | |
| 7115 |
2/2✓ Branch 0 taken 272641 times.
✓ Branch 1 taken 8211 times.
|
280852 | if(!ok) break; |
| 7116 |
1/2✓ Branch 0 taken 272641 times.
✗ Branch 1 not taken.
|
272641 | if((usewid%16)>0) //Uneven width |
| 7117 | { | ||
| 7118 | ✗ | int32_t tries_y = usehei/(offgrid ? 8 : 16); | |
| 7119 | ✗ | try_y = 0; | |
| 7120 | ✗ | for ( ; tries_y > 0; --tries_y ) | |
| 7121 | { | ||
| 7122 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+try_y,special,ndir, x+usexoffs+usewid-1, y+useyoffs+try_y, kb) && | |
| 7123 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+try_y, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+try_y, special,kb); | |
| 7124 | ✗ | try_y += (offgrid ? 8 : 16); | |
| 7125 | ✗ | if (!ok) break; | |
| 7126 | ✗ | } | |
| 7127 | ✗ | if (!ok) break; | |
| 7128 | ✗ | if((usehei%16)>0) //Uneven height | |
| 7129 | { | ||
| 7130 | ✗ | ok = !m_walkflag(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && !m_walkflag(x+usexoffs+dx+usewid-1,y+useyoffs+sv+usehei-1,special,ndir, x+usexoffs+usewid-1, y+useyoffs+usehei-1, kb) && | |
| 7131 | ✗ | !flyerblocked(x+usexoffs+usewid-1,y+useyoffs+dy+usehei-1, special,kb) && !flyerblocked(x+usexoffs+dx+usewid-1,y+useyoffs+8+usehei-1, special,kb); | |
| 7132 | ✗ | } | |
| 7133 | ✗ | } | |
| 7134 | 272641 | break; | |
| 7135 | } | ||
| 7136 | default: | ||
| 7137 | 1093 | db=99; | |
| 7138 | 1093 | return true; | |
| 7139 | } | ||
| 7140 | //Z_eventlog("\n"); | ||
| 7141 | 3492938 | return ok; | |
| 7142 | 3495563 | } | |
| 7143 | |||
| 7144 | |||
| 7145 | 2255301 | bool enemy::canmove(int32_t ndir,zfix s,int32_t special, bool kb) | |
| 7146 | { | ||
| 7147 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2255301 times.
|
2255301 | int32_t usewid = (SIZEflags&guyflagOVERRIDE_HIT_WIDTH) ? hxsz : 16; |
| 7148 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2255301 times.
|
2255301 | int32_t usehei = (SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) ? hysz : 16; |
| 7149 |
1/2✓ Branch 0 taken 2255301 times.
✗ Branch 1 not taken.
|
2255301 | if (usewid % 16 != 0) usewid += (16 - (usewid%16)); |
| 7150 |
1/2✓ Branch 0 taken 2255301 times.
✗ Branch 1 not taken.
|
2255301 | if (usehei % 16 != 0) usehei += (16 - (usehei%16)); |
| 7151 | 2255301 | --usewid; | |
| 7152 | 2255301 | --usehei; | |
| 7153 | 2255301 | return canmove(ndir,s,special,0,-8,usewid,usehei,kb); | |
| 7154 | } | ||
| 7155 | |||
| 7156 | 618801 | bool enemy::canmove(int32_t ndir,int32_t special, bool kb) | |
| 7157 | { | ||
| 7158 | 618801 | bool dodongo_move=true; //yes, it's an ugly hack, but we're going to rewrite everything later anyway - DN | |
| 7159 | |||
| 7160 |
4/4✓ Branch 0 taken 4686 times.
✓ Branch 1 taken 614115 times.
✓ Branch 2 taken 3523 times.
✓ Branch 3 taken 1163 times.
|
618801 | if(special==spw_clipright&&ndir==right) |
| 7161 | { | ||
| 7162 | 1163 | dodongo_move=canmove(ndir,(zfix)1,special,0,-8,31,15,kb); | |
| 7163 | 1163 | } | |
| 7164 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 618801 times.
|
618801 | int32_t usewid = (SIZEflags&guyflagOVERRIDE_HIT_WIDTH) ? hxsz : 16; |
| 7165 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 618801 times.
|
618801 | int32_t usehei = (SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) ? hysz : 16; |
| 7166 |
1/2✓ Branch 0 taken 618801 times.
✗ Branch 1 not taken.
|
618801 | if (usewid % 16 != 0) usewid += (16 - (usewid%16)); |
| 7167 |
1/2✓ Branch 0 taken 618801 times.
✗ Branch 1 not taken.
|
618801 | if (usehei % 16 != 0) usehei += (16 - (usehei%16)); |
| 7168 | 618801 | --usewid; | |
| 7169 | 618801 | --usehei; | |
| 7170 |
2/2✓ Branch 0 taken 331743 times.
✓ Branch 1 taken 287058 times.
|
618801 | return canmove(ndir,(zfix)1,special,0,-8,usewid,usehei,kb)&&dodongo_move; |
| 7171 | } | ||
| 7172 | |||
| 7173 | 61429 | bool enemy::canmove(int32_t ndir, bool kb) | |
| 7174 | { | ||
| 7175 | 61429 | return canmove(ndir,(zfix)1,spw_none,0,-8,15,15,kb); | |
| 7176 | } | ||
| 7177 | |||
| 7178 | // 8-directional | ||
| 7179 | 375 | void enemy::newdir_8_old(int32_t newrate,int32_t newhoming,int32_t special,int32_t dx1,int32_t dy1,int32_t dx2,int32_t dy2) | |
| 7180 | { | ||
| 7181 | 375 | int32_t ndir=0; | |
| 7182 | |||
| 7183 | // can move straight, check if it wants to turn | ||
| 7184 |
2/2✓ Branch 0 taken 367 times.
✓ Branch 1 taken 8 times.
|
375 | if(canmove_old(dir,step,special,dx1,dy1,dx2,dy2)) |
| 7185 | { | ||
| 7186 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 367 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
367 | if(grumble && (zc_oldrand()&4)<grumble) //Homing |
| 7187 | { | ||
| 7188 | ✗ | int32_t w = Lwpns.idFirst(wBait); | |
| 7189 | |||
| 7190 | ✗ | if(w>=0) | |
| 7191 | { | ||
| 7192 | ✗ | int32_t bx = Lwpns.spr(w)->x; | |
| 7193 | ✗ | int32_t by = Lwpns.spr(w)->y; | |
| 7194 | |||
| 7195 | ✗ | ndir = (bx<x) ? left : (bx!=x) ? right : 0; | |
| 7196 | |||
| 7197 | ✗ | if(abs(int32_t(y)-by)>14) | |
| 7198 | { | ||
| 7199 | ✗ | if(ndir>0) // Already left or right | |
| 7200 | { | ||
| 7201 | // Making the diagonal directions | ||
| 7202 | ✗ | ndir += (by<y) ? 2 : 4; | |
| 7203 | ✗ | } | |
| 7204 | else | ||
| 7205 | { | ||
| 7206 | ✗ | ndir = (by<y) ? up : down; | |
| 7207 | } | ||
| 7208 | ✗ | } | |
| 7209 | |||
| 7210 | ✗ | if(canmove(ndir,special,false)) | |
| 7211 | { | ||
| 7212 | ✗ | dir=ndir; | |
| 7213 | ✗ | return; | |
| 7214 | } | ||
| 7215 | ✗ | } | |
| 7216 | ✗ | } | |
| 7217 | |||
| 7218 | // Homing added. | ||
| 7219 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 367 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
367 | if(newhoming && (zc_oldrand()&255)<newhoming) |
| 7220 | { | ||
| 7221 | ✗ | ndir = lined_up(8,true); | |
| 7222 | |||
| 7223 | ✗ | if(ndir>=0 && canmove(ndir,special,false)) | |
| 7224 | { | ||
| 7225 | ✗ | dir=ndir; | |
| 7226 | ✗ | } | |
| 7227 | |||
| 7228 | ✗ | return; | |
| 7229 | } | ||
| 7230 | |||
| 7231 | 367 | int32_t r=zc_oldrand(); | |
| 7232 | |||
| 7233 |
2/4✓ Branch 0 taken 367 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 367 times.
|
367 | if(newrate>0 && !(r%newrate)) |
| 7234 | { | ||
| 7235 | 367 | ndir = ((dir+((r&64)?-1:1))&7)+8; | |
| 7236 | 367 | int32_t ndir2=((dir+((r&64)?1:-1))&7)+8; | |
| 7237 | |||
| 7238 |
2/2✓ Branch 0 taken 353 times.
✓ Branch 1 taken 14 times.
|
367 | if(canmove(ndir,step,special,dx1,dy1,dx2,dy2,false)) |
| 7239 | 353 | dir=ndir; | |
| 7240 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 11 times.
|
14 | else if(canmove(ndir2,step,special,dx1,dy1,dx2,dy2,false)) |
| 7241 | 11 | dir=ndir2; | |
| 7242 | |||
| 7243 |
3/4✓ Branch 0 taken 353 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 353 times.
✗ Branch 3 not taken.
|
367 | if(dir==ndir && (newrate>=4)) // newrate>=4, otherwise movement is biased toward upper-left |
| 7244 | // due to numerous lost fractional components. -L | ||
| 7245 | { | ||
| 7246 | ✗ | x.doFloor(); | |
| 7247 | ✗ | y.doFloor(); | |
| 7248 | ✗ | } | |
| 7249 | 367 | } | |
| 7250 | |||
| 7251 | 367 | return; | |
| 7252 | } | ||
| 7253 | |||
| 7254 | // can't move straight, must turn | ||
| 7255 | 8 | int32_t i=0; | |
| 7256 | |||
| 7257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | for(; i<32; i++) // Try random dir |
| 7258 | { | ||
| 7259 | 15 | ndir=(zc_oldrand()&7)+8; | |
| 7260 | |||
| 7261 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 8 times.
|
15 | if(canmove(ndir,step,special,dx1,dy1,dx2,dy2,false)) |
| 7262 | 8 | break; | |
| 7263 | 7 | } | |
| 7264 | |||
| 7265 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(i==32) |
| 7266 | { | ||
| 7267 | ✗ | for(ndir=8; ndir<16; ndir++) | |
| 7268 | { | ||
| 7269 | ✗ | if(canmove(ndir,step,special,dx1,dy1,dx2,dy2,false)) | |
| 7270 | ✗ | goto ok; | |
| 7271 | ✗ | } | |
| 7272 | |||
| 7273 | ✗ | ndir = (isSideViewGravity()) ? (zc_oldrand()&1 ? left : right) : -1; // Sideview enemies get trapped if their dir becomes -1 | |
| 7274 | ✗ | } | |
| 7275 | |||
| 7276 | ok: | ||
| 7277 | 8 | dir=ndir; | |
| 7278 | 8 | x.doFloor(); | |
| 7279 | 8 | y.doFloor(); | |
| 7280 | 375 | } | |
| 7281 | |||
| 7282 | 283367 | void enemy::newdir_8(int32_t newrate,int32_t newhoming,int32_t special,int32_t dx1,int32_t dy1,int32_t dx2,int32_t dy2) | |
| 7283 | { | ||
| 7284 | 283367 | int32_t ndir=0; | |
| 7285 | |||
| 7286 | // can move straight, check if it wants to turn | ||
| 7287 |
2/2✓ Branch 0 taken 266875 times.
✓ Branch 1 taken 16492 times.
|
283367 | if(canmove(dir,step,special,dx1,dy1,dx2,dy2,false)) |
| 7288 | { | ||
| 7289 |
4/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 266668 times.
✓ Branch 2 taken 106 times.
✓ Branch 3 taken 101 times.
|
266875 | if(grumble && (zc_oldrand()&4)<abs(grumble)) //Homing |
| 7290 | { | ||
| 7291 | 101 | int32_t i = Lwpns.idFirst(wBait); | |
| 7292 |
1/2✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
|
101 | if(i >= 0) //idfirst returns -1 if it can't find any |
| 7293 | { | ||
| 7294 | ✗ | weapon *w = (weapon*)Lwpns.spr(i); | |
| 7295 | ✗ | if (get_bit(quest_rules, qr_FIND_CLOSEST_BAIT)) | |
| 7296 | { | ||
| 7297 | int32_t currentrange; | ||
| 7298 | ✗ | if (distance(x, y, w->x, w->y) < w->misc2 || w->misc2 == 0) currentrange = distance(x, y, w->x, w->y); | |
| 7299 | ✗ | else currentrange = -1; | |
| 7300 | ✗ | int curid = i; | |
| 7301 | ✗ | ++i; //increment beforehand cause we just checked the first bait weapon and all others must be after it. ...otherwise it wouldn't be the first. -Deedee | |
| 7302 | ✗ | for(; i<Lwpns.Count(); ++i) | |
| 7303 | { | ||
| 7304 | ✗ | weapon *lw = (weapon*)Lwpns.spr(i); | |
| 7305 | ✗ | if (lw->id == wBait && distance(x, y, lw->x, lw->y) < currentrange && (distance(x, y, lw->x, lw->y) < lw->misc2 || lw->misc2 == 0)) | |
| 7306 | { | ||
| 7307 | ✗ | currentrange = distance(x, y, lw->x, lw->y); | |
| 7308 | ✗ | curid = i; | |
| 7309 | ✗ | } | |
| 7310 | ✗ | } | |
| 7311 | ✗ | i = curid; | |
| 7312 | ✗ | if (currentrange == -1) i = -1; | |
| 7313 | ✗ | } | |
| 7314 | else | ||
| 7315 | { | ||
| 7316 | ✗ | if (!(distance(x, y, w->x, w->y) < w->misc2 || w->misc2 == 0)) i = -1; | |
| 7317 | } | ||
| 7318 | ✗ | if(i>=0) | |
| 7319 | { | ||
| 7320 | ✗ | int32_t bx = Lwpns.spr(i)->x; | |
| 7321 | ✗ | int32_t by = Lwpns.spr(i)->y; | |
| 7322 | |||
| 7323 | ✗ | ndir = (bx<x) ? left : (bx!=x) ? right : 0; | |
| 7324 | |||
| 7325 | ✗ | if(abs(int32_t(y)-by)>14) | |
| 7326 | { | ||
| 7327 | ✗ | if(ndir>0) // Already left or right | |
| 7328 | { | ||
| 7329 | // Making the diagonal directions | ||
| 7330 | ✗ | ndir += (by<y) ? 2 : 4; | |
| 7331 | ✗ | } | |
| 7332 | else | ||
| 7333 | { | ||
| 7334 | ✗ | ndir = (by<y) ? up : down; | |
| 7335 | } | ||
| 7336 | ✗ | } | |
| 7337 | ✗ | if (grumble < 0 || (itemsbuf[((weapon*)Lwpns.spr(i))->parentitem].flags & ITEM_FLAG1)) ndir = oppositeDir[ndir]; | |
| 7338 | ✗ | if(canmove(ndir,special,false)) | |
| 7339 | { | ||
| 7340 | ✗ | dir=ndir; | |
| 7341 | ✗ | return; | |
| 7342 | } | ||
| 7343 | ✗ | } | |
| 7344 | ✗ | } | |
| 7345 | 101 | } | |
| 7346 | |||
| 7347 | // Homing added. | ||
| 7348 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 266875 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
266875 | if(newhoming && (zc_oldrand()&255)<abs(newhoming)) |
| 7349 | { | ||
| 7350 | ✗ | ndir = lined_up(8,true); | |
| 7351 | ✗ | if (newhoming < 0 && ndir >= 0) ndir = oppositeDir[ndir]; | |
| 7352 | ✗ | if(ndir>=0 && canmove(ndir,special,false)) | |
| 7353 | { | ||
| 7354 | ✗ | dir=ndir; | |
| 7355 | ✗ | } | |
| 7356 | |||
| 7357 | ✗ | return; | |
| 7358 | } | ||
| 7359 | |||
| 7360 | 266875 | int32_t r=zc_oldrand(); | |
| 7361 | |||
| 7362 |
4/4✓ Branch 0 taken 171868 times.
✓ Branch 1 taken 95007 times.
✓ Branch 2 taken 92812 times.
✓ Branch 3 taken 79056 times.
|
266875 | if(newrate>0 && !(r%newrate)) |
| 7363 | { | ||
| 7364 | 79056 | ndir = ((dir+((r&64)?-1:1))&7)+8; | |
| 7365 | 79056 | int32_t ndir2=((dir+((r&64)?1:-1))&7)+8; | |
| 7366 | |||
| 7367 |
2/2✓ Branch 0 taken 76413 times.
✓ Branch 1 taken 2643 times.
|
79056 | if(canmove(ndir,step,special,dx1,dy1,dx2,dy2,false)) |
| 7368 | 76413 | dir=ndir; | |
| 7369 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 2538 times.
|
2643 | else if(canmove(ndir2,step,special,dx1,dy1,dx2,dy2,false)) |
| 7370 | 2538 | dir=ndir2; | |
| 7371 | |||
| 7372 |
4/4✓ Branch 0 taken 76413 times.
✓ Branch 1 taken 2643 times.
✓ Branch 2 taken 72903 times.
✓ Branch 3 taken 3510 times.
|
79056 | if(dir==ndir && (newrate>=4)) // newrate>=4, otherwise movement is biased toward upper-left |
| 7373 | // due to numerous lost fractional components. -L | ||
| 7374 | { | ||
| 7375 | 3510 | x.doFloor(); | |
| 7376 | 3510 | y.doFloor(); | |
| 7377 | 3510 | } | |
| 7378 | 79056 | } | |
| 7379 | |||
| 7380 | 266875 | return; | |
| 7381 | } | ||
| 7382 | |||
| 7383 | // can't move straight, must turn | ||
| 7384 | 16492 | int32_t i=0; | |
| 7385 | |||
| 7386 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 30575 times.
|
30589 | for(; i<32; i++) // Try random dir |
| 7387 | { | ||
| 7388 | 30575 | ndir=(zc_oldrand()&7)+8; | |
| 7389 | |||
| 7390 |
2/2✓ Branch 0 taken 14097 times.
✓ Branch 1 taken 16478 times.
|
30575 | if(canmove(ndir,step,special,dx1,dy1,dx2,dy2,false)) |
| 7391 | 16478 | break; | |
| 7392 | 14097 | } | |
| 7393 | |||
| 7394 |
2/2✓ Branch 0 taken 16478 times.
✓ Branch 1 taken 14 times.
|
16496 | if(i==32) |
| 7395 | { | ||
| 7396 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 4 times.
|
48 | for(ndir=8; ndir<16; ndir++) |
| 7397 | { | ||
| 7398 |
2/2✓ Branch 0 taken 34 times.
✓ Branch 1 taken 10 times.
|
44 | if(canmove(ndir,step,special,dx1,dy1,dx2,dy2,false)) |
| 7399 | 10 | goto ok; | |
| 7400 | 34 | } | |
| 7401 | |||
| 7402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | ndir = (isSideViewGravity()) ? (zc_oldrand()&1 ? left : right) : -1; // Sideview enemies get trapped if their dir becomes -1 |
| 7403 | 4 | } | |
| 7404 | |||
| 7405 | ok: | ||
| 7406 | 16492 | dir=ndir; | |
| 7407 | 16492 | x.doFloor(); | |
| 7408 | 16492 | y.doFloor(); | |
| 7409 | 283367 | } | |
| 7410 | |||
| 7411 | 279940 | void enemy::newdir_8(int32_t newrate,int32_t newhoming,int32_t special) | |
| 7412 | { | ||
| 7413 | 279940 | newdir_8(newrate,newhoming,special,0,-8,15,15); | |
| 7414 | 279940 | } | |
| 7415 | |||
| 7416 | 375 | void enemy::newdir_8_old(int32_t newrate,int32_t newhoming,int32_t special) | |
| 7417 | { | ||
| 7418 | 375 | newdir_8_old(newrate,newhoming,special,0,-8,15,15); | |
| 7419 | 375 | } | |
| 7420 | |||
| 7421 | // makes the enemy slide backwards when hit | ||
| 7422 | // sclk: first byte is clk, second byte is dir | ||
| 7423 | // makes the enemy slide backwards when hit | ||
| 7424 | // sclk: first byte is clk, second byte is dir | ||
| 7425 | 8661678 | int32_t enemy::slide() | |
| 7426 | { | ||
| 7427 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8661678 times.
|
8661678 | if(script_knockback_clk!=0) //scripted knockback |
| 7428 | { | ||
| 7429 | ✗ | sclk = 0; | |
| 7430 | ✗ | return 1; //scripted knockback ran | |
| 7431 | } | ||
| 7432 |
5/6✓ Branch 0 taken 53429 times.
✓ Branch 1 taken 8608249 times.
✓ Branch 2 taken 5357 times.
✓ Branch 3 taken 48072 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5357 times.
|
8661678 | if(sclk==0 || (hp<=0 && !immortal)) |
| 7433 | 8613606 | return 0; | |
| 7434 | |||
| 7435 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48072 times.
|
48072 | if(knockbackflags & FLAG_NOSLIDE) |
| 7436 | { | ||
| 7437 | ✗ | sclk = 0; | |
| 7438 | ✗ | if(!OFFGRID_ENEMY) | |
| 7439 | { | ||
| 7440 | //Fix to grid | ||
| 7441 | //x = (int32_t(x)+8)-((int32_t(x)+8)%16); | ||
| 7442 | //y = (int32_t(y)+8)-((int32_t(y)+8)%16); | ||
| 7443 | ✗ | do_fix(x, 16, true); | |
| 7444 | ✗ | do_fix(y, 16, true); | |
| 7445 | ✗ | } | |
| 7446 | ✗ | return 0; | |
| 7447 | } | ||
| 7448 |
8/10✓ Branch 0 taken 4852 times.
✓ Branch 1 taken 43220 times.
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 4827 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 25 times.
✓ Branch 6 taken 3620 times.
✓ Branch 7 taken 1207 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 25 times.
|
48072 | if((sclk&255)==16 && (get_bit(quest_rules,qr_OLD_ENEMY_KNOCKBACK_COLLISION) || knockbackSpeed!=4 ? !canmove(sclk>>8,(zfix) (dmisc2==e2tSPLITHIT ? 1 : 12),0,true) : !canmove(sclk>>8,(zfix) (dmisc2==e2tSPLITHIT ? 1 : knockbackSpeed),0,0,0,15,15,true))) |
| 7449 | { | ||
| 7450 | 1207 | sclk=0; | |
| 7451 | 1207 | return 0; | |
| 7452 | } | ||
| 7453 | |||
| 7454 | 46865 | --sclk; | |
| 7455 | |||
| 7456 |
5/5✓ Branch 0 taken 1657 times.
✓ Branch 1 taken 5694 times.
✓ Branch 2 taken 5991 times.
✓ Branch 3 taken 15560 times.
✓ Branch 4 taken 17963 times.
|
46865 | switch(sclk>>8) |
| 7457 | { | ||
| 7458 | case up: | ||
| 7459 | { | ||
| 7460 |
4/4✓ Branch 0 taken 633 times.
✓ Branch 1 taken 5061 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 5688 times.
|
5694 | if(y<=(dmisc2==e2tSPLITHIT ? 0 : (get_bit(quest_rules,qr_OLD_ENEMY_KNOCKBACK_COLLISION)?16:0))) //vires |
| 7461 | { | ||
| 7462 | 6 | sclk=0; | |
| 7463 | 6 | return 0; | |
| 7464 | } | ||
| 7465 |
4/4✓ Branch 0 taken 633 times.
✓ Branch 1 taken 5055 times.
✓ Branch 2 taken 529 times.
✓ Branch 3 taken 104 times.
|
5688 | if ( dmisc2==e2tSPLITHIT && !canmove(sclk>>8,(zfix)(4),0,true) ) { sclk=0; return 0; } //vires |
| 7466 | |||
| 7467 | 5584 | break; | |
| 7468 | } | ||
| 7469 | case down: | ||
| 7470 | { | ||
| 7471 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5989 times.
|
5991 | if(y>=(dmisc2==e2tSPLITHIT ? 150 : 160)) //was 160 --changed for vires bug. |
| 7472 | { | ||
| 7473 | 2 | sclk=0; | |
| 7474 | 2 | return 0; | |
| 7475 | } | ||
| 7476 |
4/4✓ Branch 0 taken 734 times.
✓ Branch 1 taken 5255 times.
✓ Branch 2 taken 639 times.
✓ Branch 3 taken 95 times.
|
5989 | if ( dmisc2==e2tSPLITHIT && !canmove(sclk>>8,(zfix)(4),0,true) ) { sclk=0; return 0; } //vires |
| 7477 | |||
| 7478 | 5894 | break; | |
| 7479 | } | ||
| 7480 | case left: | ||
| 7481 | { | ||
| 7482 |
4/4✓ Branch 0 taken 1311 times.
✓ Branch 1 taken 14249 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 15547 times.
|
15560 | if(x<=(dmisc2==e2tSPLITHIT ? 0 : (get_bit(quest_rules,qr_OLD_ENEMY_KNOCKBACK_COLLISION)?16:0))) |
| 7483 | { | ||
| 7484 | 13 | sclk=0; | |
| 7485 | 13 | return 0; | |
| 7486 | } | ||
| 7487 |
4/4✓ Branch 0 taken 1311 times.
✓ Branch 1 taken 14236 times.
✓ Branch 2 taken 1204 times.
✓ Branch 3 taken 107 times.
|
15547 | if ( dmisc2==e2tSPLITHIT && !canmove(sclk>>8,(zfix)(4),0,true) ) { sclk=0; return 0; } |
| 7488 | |||
| 7489 | 15440 | break; | |
| 7490 | } | ||
| 7491 | case right: | ||
| 7492 | { | ||
| 7493 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17963 times.
|
17963 | if(x>=(dmisc2==e2tSPLITHIT ? 255 : 240)) //vires |
| 7494 | { | ||
| 7495 | ✗ | sclk=0; | |
| 7496 | ✗ | return 0; | |
| 7497 | } | ||
| 7498 |
4/4✓ Branch 0 taken 2286 times.
✓ Branch 1 taken 15677 times.
✓ Branch 2 taken 2130 times.
✓ Branch 3 taken 156 times.
|
17963 | if ( dmisc2==e2tSPLITHIT && !canmove(sclk>>8,(zfix)(4),0,true) ) { sclk=0; return 0; } //vires |
| 7499 | 17807 | break; | |
| 7500 | } | ||
| 7501 | } | ||
| 7502 | |||
| 7503 | 46382 | int32_t move = knockbackSpeed; | |
| 7504 |
2/2✓ Branch 0 taken 43983 times.
✓ Branch 1 taken 46382 times.
|
90365 | while(move>0) |
| 7505 | { | ||
| 7506 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46382 times.
|
46382 | int32_t thismove = zc_min(8, move); |
| 7507 | 46382 | move -= thismove; | |
| 7508 | 46382 | hitdir = (sclk>>8); | |
| 7509 |
5/5✓ Branch 0 taken 1657 times.
✓ Branch 1 taken 5584 times.
✓ Branch 2 taken 5894 times.
✓ Branch 3 taken 15440 times.
✓ Branch 4 taken 17807 times.
|
46382 | switch(sclk>>8) |
| 7510 | { | ||
| 7511 | case up: | ||
| 7512 | 5584 | y-=thismove; | |
| 7513 | 5584 | break; | |
| 7514 | |||
| 7515 | case down: | ||
| 7516 | 5894 | y+=thismove; | |
| 7517 | 5894 | break; | |
| 7518 | |||
| 7519 | case left: | ||
| 7520 | 15440 | x-=thismove; | |
| 7521 | 15440 | break; | |
| 7522 | |||
| 7523 | case right: | ||
| 7524 | 17807 | x+=thismove; | |
| 7525 | 17807 | break; | |
| 7526 | } | ||
| 7527 |
2/2✓ Branch 0 taken 43983 times.
✓ Branch 1 taken 2399 times.
|
46382 | if(!canmove(sclk>>8,(zfix)0,0,true)) |
| 7528 | { | ||
| 7529 |
3/3✓ Branch 0 taken 996 times.
✓ Branch 1 taken 1399 times.
✓ Branch 2 taken 4 times.
|
2399 | switch(sclk>>8) |
| 7530 | { | ||
| 7531 | case up: | ||
| 7532 | case down: | ||
| 7533 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 996 times.
|
996 | if(y < 0) |
| 7534 | ✗ | y = 0; | |
| 7535 |
2/2✓ Branch 0 taken 173 times.
✓ Branch 1 taken 823 times.
|
996 | else if((int32_t(y)&15) > 7) |
| 7536 | 173 | y=(int32_t(y)&0xF0)+16; | |
| 7537 | else | ||
| 7538 | 823 | y=(int32_t(y)&0xF0); | |
| 7539 | |||
| 7540 | 996 | break; | |
| 7541 | |||
| 7542 | case left: | ||
| 7543 | case right: | ||
| 7544 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1398 times.
|
1399 | if(x < 0) |
| 7545 | 1 | x = 0; | |
| 7546 |
2/2✓ Branch 0 taken 415 times.
✓ Branch 1 taken 983 times.
|
1398 | else if((int32_t(x)&15) > 7) |
| 7547 | 415 | x=(int32_t(x)&0xF0)+16; | |
| 7548 | else | ||
| 7549 | 983 | x=(int32_t(x)&0xF0); | |
| 7550 | |||
| 7551 | 1399 | break; | |
| 7552 | } | ||
| 7553 | |||
| 7554 | 2399 | sclk=0; | |
| 7555 | 2399 | clk3=0; | |
| 7556 | 2399 | break; | |
| 7557 | } | ||
| 7558 | } | ||
| 7559 | |||
| 7560 |
2/2✓ Branch 0 taken 42761 times.
✓ Branch 1 taken 3621 times.
|
46382 | if((sclk&255)==0) |
| 7561 | { | ||
| 7562 | //hitdir = -1; | ||
| 7563 | 3621 | sclk=0; | |
| 7564 | 3621 | } | |
| 7565 | 46382 | return 2; | |
| 7566 | 8661678 | } | |
| 7567 | |||
| 7568 | ✗ | bool enemy::can_slide() | |
| 7569 | { | ||
| 7570 | ✗ | if(sclk==0 || (hp<=0 && !immortal)) | |
| 7571 | ✗ | return false; | |
| 7572 | |||
| 7573 | ✗ | if((sclk&255)==16 && (get_bit(quest_rules,qr_OLD_ENEMY_KNOCKBACK_COLLISION) || knockbackSpeed!=4 ? !canmove(sclk>>8,(zfix) (dmisc2==e2tSPLITHIT ? 1 : 12),0,true) : !canmove(sclk>>8,(zfix) (dmisc2==e2tSPLITHIT ? 1 : knockbackSpeed),0,true))) | |
| 7574 | { | ||
| 7575 | ✗ | return false; | |
| 7576 | } | ||
| 7577 | |||
| 7578 | ✗ | return true; | |
| 7579 | ✗ | } | |
| 7580 | |||
| 7581 | ✗ | bool enemy::fslide() | |
| 7582 | { | ||
| 7583 | ✗ | if(sclk==0 || (hp<=0 && !immortal)) | |
| 7584 | ✗ | return false; | |
| 7585 | |||
| 7586 | ✗ | if((sclk&255)==16 && !canmove(sclk>>8,(zfix)12,spw_floater,true)) | |
| 7587 | { | ||
| 7588 | ✗ | sclk=0; | |
| 7589 | ✗ | return false; | |
| 7590 | } | ||
| 7591 | |||
| 7592 | ✗ | --sclk; | |
| 7593 | |||
| 7594 | ✗ | switch(sclk>>8) | |
| 7595 | { | ||
| 7596 | case up: | ||
| 7597 | ✗ | if(y<=16) | |
| 7598 | { | ||
| 7599 | ✗ | sclk=0; | |
| 7600 | ✗ | return false; | |
| 7601 | } | ||
| 7602 | |||
| 7603 | ✗ | break; | |
| 7604 | |||
| 7605 | case down: | ||
| 7606 | ✗ | if(y>=160) | |
| 7607 | { | ||
| 7608 | ✗ | sclk=0; | |
| 7609 | ✗ | return false; | |
| 7610 | } | ||
| 7611 | |||
| 7612 | ✗ | break; | |
| 7613 | |||
| 7614 | case left: | ||
| 7615 | ✗ | if(x<=16) | |
| 7616 | { | ||
| 7617 | ✗ | sclk=0; | |
| 7618 | ✗ | return false; | |
| 7619 | } | ||
| 7620 | |||
| 7621 | ✗ | break; | |
| 7622 | |||
| 7623 | case right: | ||
| 7624 | ✗ | if(x>=240) | |
| 7625 | { | ||
| 7626 | ✗ | sclk=0; | |
| 7627 | ✗ | return false; | |
| 7628 | } | ||
| 7629 | |||
| 7630 | ✗ | break; | |
| 7631 | } | ||
| 7632 | ✗ | hitdir = (sclk>>8); | |
| 7633 | ✗ | switch(sclk>>8) | |
| 7634 | { | ||
| 7635 | case up: | ||
| 7636 | ✗ | y-=4; | |
| 7637 | ✗ | break; | |
| 7638 | |||
| 7639 | case down: | ||
| 7640 | ✗ | y+=4; | |
| 7641 | ✗ | break; | |
| 7642 | |||
| 7643 | case left: | ||
| 7644 | ✗ | x-=4; | |
| 7645 | ✗ | break; | |
| 7646 | |||
| 7647 | case right: | ||
| 7648 | ✗ | x+=4; | |
| 7649 | ✗ | break; | |
| 7650 | } | ||
| 7651 | |||
| 7652 | ✗ | if(!canmove(sclk>>8,(zfix)0,spw_floater,true)) | |
| 7653 | { | ||
| 7654 | ✗ | switch(sclk>>8) | |
| 7655 | { | ||
| 7656 | case up: | ||
| 7657 | case down: | ||
| 7658 | ✗ | if((int32_t(y)&15) > 7) | |
| 7659 | ✗ | y=(int32_t(y)&0xF0)+16; | |
| 7660 | else | ||
| 7661 | ✗ | y=(int32_t(y)&0xF0); | |
| 7662 | |||
| 7663 | ✗ | break; | |
| 7664 | |||
| 7665 | case left: | ||
| 7666 | case right: | ||
| 7667 | ✗ | if((int32_t(x)&15) > 7) | |
| 7668 | ✗ | x=(int32_t(x)&0xF0)+16; | |
| 7669 | else | ||
| 7670 | ✗ | x=(int32_t(x)&0xF0); | |
| 7671 | |||
| 7672 | ✗ | break; | |
| 7673 | } | ||
| 7674 | |||
| 7675 | ✗ | sclk=0; | |
| 7676 | ✗ | clk3=0; | |
| 7677 | ✗ | } | |
| 7678 | |||
| 7679 | ✗ | if((sclk&255)==0) | |
| 7680 | ✗ | sclk=0; | |
| 7681 | |||
| 7682 | ✗ | return true; | |
| 7683 | ✗ | } | |
| 7684 | |||
| 7685 | ✗ | bool enemy::knockback(int32_t time, int32_t dir, int32_t speed) | |
| 7686 | { | ||
| 7687 | ✗ | if((hp<=0 && !immortal)) return false; //No knocking back dead/mid-knockback enemies | |
| 7688 | ✗ | if(!canmove(dir,(zfix)speed,0,0,0,15,15,true)) return false; //from slide(); collision check | |
| 7689 | ✗ | bool ret = sprite::knockback(time, dir, speed); | |
| 7690 | ✗ | if(ret) sclk = 0; //kill engine knockback if interrupted | |
| 7691 | //! Perhaps also set hitdir here, if needed for timing? -Z | ||
| 7692 | ✗ | return ret; | |
| 7693 | ✗ | } | |
| 7694 | |||
| 7695 | 19303704 | bool enemy::runKnockback() | |
| 7696 | { | ||
| 7697 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19303704 times.
|
19303704 | if((script_knockback_clk&0xFF)==0) |
| 7698 | { | ||
| 7699 | 19303704 | script_knockback_clk = 0; | |
| 7700 | 19303704 | return false; | |
| 7701 | } | ||
| 7702 | ✗ | if(knockbackflags & FLAG_NOSCRIPTKNOCKBACK) | |
| 7703 | { | ||
| 7704 | ✗ | return false; | |
| 7705 | } | ||
| 7706 | ✗ | int32_t move = script_knockback_speed; | |
| 7707 | ✗ | int32_t kb_dir = script_knockback_clk>>8; | |
| 7708 | ✗ | --script_knockback_clk; | |
| 7709 | |||
| 7710 | ✗ | while(move>0) | |
| 7711 | { | ||
| 7712 | ✗ | int32_t thismove = zc_min(get_bit(quest_rules, qr_OLD_SCRIPTED_KNOCKBACK)?8:4, move); | |
| 7713 | ✗ | move -= thismove; | |
| 7714 | ✗ | hitdir = kb_dir; | |
| 7715 | ✗ | switch(kb_dir) | |
| 7716 | { | ||
| 7717 | case r_up: | ||
| 7718 | case l_up: | ||
| 7719 | case up: | ||
| 7720 | ✗ | y-=thismove; | |
| 7721 | ✗ | break; | |
| 7722 | |||
| 7723 | case r_down: | ||
| 7724 | case l_down: | ||
| 7725 | case down: | ||
| 7726 | ✗ | y+=thismove; | |
| 7727 | ✗ | break; | |
| 7728 | } | ||
| 7729 | ✗ | switch(kb_dir) | |
| 7730 | { | ||
| 7731 | case l_up: | ||
| 7732 | case l_down: | ||
| 7733 | case left: | ||
| 7734 | ✗ | x-=thismove; | |
| 7735 | ✗ | break; | |
| 7736 | |||
| 7737 | case r_up: | ||
| 7738 | case r_down: | ||
| 7739 | case right: | ||
| 7740 | ✗ | x+=thismove; | |
| 7741 | ✗ | break; | |
| 7742 | } | ||
| 7743 | ✗ | if (get_bit(quest_rules, qr_OLD_SCRIPTED_KNOCKBACK)) | |
| 7744 | { | ||
| 7745 | ✗ | if(!canmove(kb_dir,(zfix)0,0,true)) | |
| 7746 | { | ||
| 7747 | ✗ | script_knockback_clk=0; | |
| 7748 | ✗ | clk3=0; | |
| 7749 | //Fix to grid | ||
| 7750 | ✗ | switch(kb_dir) | |
| 7751 | { | ||
| 7752 | case up: | ||
| 7753 | case down: | ||
| 7754 | ✗ | break; | |
| 7755 | default: | ||
| 7756 | ✗ | if(x < 0) | |
| 7757 | ✗ | x = 0; | |
| 7758 | ✗ | else if((int32_t(x)&15) > 7) | |
| 7759 | ✗ | x=(int32_t(x)&0xF0)+16; | |
| 7760 | else | ||
| 7761 | ✗ | x=(int32_t(x)&0xF0); | |
| 7762 | ✗ | break; | |
| 7763 | } | ||
| 7764 | ✗ | switch(kb_dir) | |
| 7765 | { | ||
| 7766 | case left: | ||
| 7767 | case right: | ||
| 7768 | ✗ | break; | |
| 7769 | default: | ||
| 7770 | ✗ | if(y < 0) | |
| 7771 | ✗ | y = 0; | |
| 7772 | ✗ | else if((int32_t(y)&15) > 7) | |
| 7773 | ✗ | y=(int32_t(y)&0xF0)+16; | |
| 7774 | else | ||
| 7775 | ✗ | y=(int32_t(y)&0xF0); | |
| 7776 | ✗ | break; | |
| 7777 | } | ||
| 7778 | ✗ | break; | |
| 7779 | } | ||
| 7780 | ✗ | } | |
| 7781 | else | ||
| 7782 | { | ||
| 7783 | ✗ | if(!scr_canplace(x,y,0,true)) | |
| 7784 | { | ||
| 7785 | ✗ | script_knockback_clk=0; | |
| 7786 | ✗ | clk3=0; | |
| 7787 | //Fix to grid | ||
| 7788 | ✗ | if (OFFGRID_ENEMY) | |
| 7789 | { | ||
| 7790 | ✗ | switch(kb_dir) | |
| 7791 | { | ||
| 7792 | case up: | ||
| 7793 | case down: | ||
| 7794 | ✗ | break; | |
| 7795 | default: | ||
| 7796 | ✗ | if(x < 0) | |
| 7797 | ✗ | x = 0; | |
| 7798 | ✗ | else if((int32_t(x)&7) > 3) | |
| 7799 | ✗ | x=(int32_t(x)&0xF8)+8; | |
| 7800 | else | ||
| 7801 | ✗ | x=(int32_t(x)&0xF8); | |
| 7802 | ✗ | break; | |
| 7803 | } | ||
| 7804 | ✗ | switch(kb_dir) | |
| 7805 | { | ||
| 7806 | case left: | ||
| 7807 | case right: | ||
| 7808 | ✗ | break; | |
| 7809 | default: | ||
| 7810 | ✗ | if(y < 0) | |
| 7811 | ✗ | y = 0; | |
| 7812 | ✗ | else if((int32_t(y)&7) > 3) | |
| 7813 | ✗ | y=(int32_t(y)&0xF8)+8; | |
| 7814 | else | ||
| 7815 | ✗ | y=(int32_t(y)&0xF8); | |
| 7816 | ✗ | break; | |
| 7817 | } | ||
| 7818 | ✗ | } | |
| 7819 | else | ||
| 7820 | { | ||
| 7821 | ✗ | switch(kb_dir) | |
| 7822 | { | ||
| 7823 | case up: | ||
| 7824 | case down: | ||
| 7825 | ✗ | break; | |
| 7826 | default: | ||
| 7827 | ✗ | if(x < 0) | |
| 7828 | ✗ | x = 0; | |
| 7829 | ✗ | else if((int32_t(x)&15) > 7) | |
| 7830 | ✗ | x=(int32_t(x)&0xF0)+16; | |
| 7831 | else | ||
| 7832 | ✗ | x=(int32_t(x)&0xF0); | |
| 7833 | ✗ | break; | |
| 7834 | } | ||
| 7835 | ✗ | switch(kb_dir) | |
| 7836 | { | ||
| 7837 | case left: | ||
| 7838 | case right: | ||
| 7839 | ✗ | break; | |
| 7840 | default: | ||
| 7841 | ✗ | if(y < 0) | |
| 7842 | ✗ | y = 0; | |
| 7843 | ✗ | else if((int32_t(y)&15) > 7) | |
| 7844 | ✗ | y=(int32_t(y)&0xF0)+16; | |
| 7845 | else | ||
| 7846 | ✗ | y=(int32_t(y)&0xF0); | |
| 7847 | ✗ | break; | |
| 7848 | } | ||
| 7849 | } | ||
| 7850 | ✗ | break; | |
| 7851 | } | ||
| 7852 | |||
| 7853 | } | ||
| 7854 | } | ||
| 7855 | ✗ | return true; | |
| 7856 | 19303704 | } | |
| 7857 | // changes enemy's direction, checking restrictions | ||
| 7858 | // rate: 0 = no random changes, 16 = always random change | ||
| 7859 | // homing: 0 = none, 256 = always | ||
| 7860 | // grumble 0 = none, 4 = strongest appetite | ||
| 7861 | 286994 | void enemy::newdir(int32_t newrate,int32_t newhoming,int32_t special) | |
| 7862 | { | ||
| 7863 | 286994 | int32_t ndir=-1; | |
| 7864 | |||
| 7865 |
4/4✓ Branch 0 taken 65452 times.
✓ Branch 1 taken 221542 times.
✓ Branch 2 taken 23332 times.
✓ Branch 3 taken 42120 times.
|
286994 | if(grumble != 0 && (zc_oldrand()&3)<abs(grumble)) //yes, I know checking if grumble is equal to if grumble == 0, but the latter makes the intention more clear to less experienced coders who might join. |
| 7866 | { | ||
| 7867 | 42120 | int32_t i = Lwpns.idFirst(wBait); | |
| 7868 |
1/2✓ Branch 0 taken 42120 times.
✗ Branch 1 not taken.
|
42120 | if(i >= 0) //idfirst returns -1 if it can't find any |
| 7869 | { | ||
| 7870 | ✗ | weapon *w = (weapon*)Lwpns.spr(i); | |
| 7871 | ✗ | if (get_bit(quest_rules, qr_FIND_CLOSEST_BAIT)) | |
| 7872 | { | ||
| 7873 | int32_t currentrange; | ||
| 7874 | ✗ | if (distance(x, y, w->x, w->y) < w->misc2 || w->misc2 == 0) currentrange = distance(x, y, w->x, w->y); | |
| 7875 | ✗ | else currentrange = -1; | |
| 7876 | ✗ | int curid = i; | |
| 7877 | ✗ | ++i; //increment beforehand cause we just checked the first bait weapon and all others must be after it. ...otherwise it wouldn't be the first. -Deedee | |
| 7878 | ✗ | for(; i<Lwpns.Count(); ++i) | |
| 7879 | { | ||
| 7880 | ✗ | weapon *lw = (weapon*)Lwpns.spr(i); | |
| 7881 | ✗ | if (lw->id == wBait && distance(x, y, lw->x, lw->y) < currentrange && (distance(x, y, lw->x, lw->y) < lw->misc2 || lw->misc2 == 0)) | |
| 7882 | { | ||
| 7883 | ✗ | currentrange = distance(x, y, lw->x, lw->y); | |
| 7884 | ✗ | curid = i; | |
| 7885 | ✗ | } | |
| 7886 | ✗ | } | |
| 7887 | ✗ | i = curid; | |
| 7888 | ✗ | if (currentrange == -1) i = -1; | |
| 7889 | ✗ | } | |
| 7890 | else | ||
| 7891 | { | ||
| 7892 | ✗ | if (!(distance(x, y, w->x, w->y) < w->misc2 || w->misc2 == 0)) i = -1; | |
| 7893 | } | ||
| 7894 | ✗ | if (i >= 0) | |
| 7895 | { | ||
| 7896 | ✗ | int32_t bx = Lwpns.spr(i)->x; | |
| 7897 | ✗ | int32_t by = Lwpns.spr(i)->y; | |
| 7898 | |||
| 7899 | ✗ | if(abs(int32_t(y)-by)>14) | |
| 7900 | { | ||
| 7901 | ✗ | ndir = (by<y) ? up : down; | |
| 7902 | ✗ | if (grumble < 0 || (itemsbuf[((weapon*)Lwpns.spr(i))->parentitem].flags & ITEM_FLAG1)) ndir = oppositeDir[ndir]; | |
| 7903 | ✗ | if(canmove(ndir,special,false)) | |
| 7904 | { | ||
| 7905 | ✗ | dir=ndir; | |
| 7906 | ✗ | return; | |
| 7907 | } | ||
| 7908 | ✗ | } | |
| 7909 | |||
| 7910 | ✗ | ndir = (bx<x) ? left : right; | |
| 7911 | ✗ | if (grumble < 0 || (itemsbuf[((weapon*)Lwpns.spr(i))->parentitem].flags & ITEM_FLAG1)) ndir = oppositeDir[ndir]; | |
| 7912 | ✗ | if(canmove(ndir,special,false)) | |
| 7913 | { | ||
| 7914 | ✗ | dir=ndir; | |
| 7915 | ✗ | return; | |
| 7916 | } | ||
| 7917 | ✗ | } | |
| 7918 | ✗ | } | |
| 7919 | 42120 | } | |
| 7920 | |||
| 7921 |
2/2✓ Branch 0 taken 196737 times.
✓ Branch 1 taken 90257 times.
|
286994 | if((zc_oldrand()&255)<abs(newhoming)) |
| 7922 | { | ||
| 7923 | 90257 | ndir = lined_up(8,false); | |
| 7924 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 90257 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
90257 | if (newhoming < 0 && ndir >= 0) ndir = oppositeDir[ndir]; |
| 7925 |
4/4✓ Branch 0 taken 24021 times.
✓ Branch 1 taken 66236 times.
✓ Branch 2 taken 3222 times.
✓ Branch 3 taken 20799 times.
|
90257 | if(ndir>=0 && canmove(ndir,special,false)) |
| 7926 | { | ||
| 7927 | 20799 | dir=ndir; | |
| 7928 | 20799 | return; | |
| 7929 | } | ||
| 7930 | 69458 | } | |
| 7931 | |||
| 7932 | 266195 | int32_t i=0; | |
| 7933 | |||
| 7934 |
2/2✓ Branch 0 taken 1156 times.
✓ Branch 1 taken 591462 times.
|
592618 | for(; i<32; i++) |
| 7935 | { | ||
| 7936 | 591462 | int32_t r=zc_oldrand(); | |
| 7937 | |||
| 7938 |
2/2✓ Branch 0 taken 182374 times.
✓ Branch 1 taken 409088 times.
|
591462 | if((r&15)<newrate) |
| 7939 | 182374 | ndir=(r>>4)&3; | |
| 7940 | else | ||
| 7941 | 409088 | ndir=dir; | |
| 7942 | |||
| 7943 |
2/2✓ Branch 0 taken 326423 times.
✓ Branch 1 taken 265039 times.
|
591462 | if(canmove(ndir,special,false)) |
| 7944 | 265039 | break; | |
| 7945 | 326423 | } | |
| 7946 | |||
| 7947 |
2/2✓ Branch 0 taken 265039 times.
✓ Branch 1 taken 1156 times.
|
266602 | if(i==32) |
| 7948 | { | ||
| 7949 |
2/2✓ Branch 0 taken 3318 times.
✓ Branch 1 taken 407 times.
|
3725 | for(ndir=0; ndir<4; ndir++) |
| 7950 | { | ||
| 7951 |
2/2✓ Branch 0 taken 2569 times.
✓ Branch 1 taken 749 times.
|
3318 | if(canmove(ndir,special,false)) |
| 7952 | 749 | goto ok; | |
| 7953 | 2569 | } | |
| 7954 | |||
| 7955 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 347 times.
|
407 | ndir = (isSideViewGravity()) ? (zc_oldrand()&1 ? left : right) : -1; // Sideview enemies get trapped if their dir becomes -1 |
| 7956 | //...Isn't that the point? I'm not sure I understand. Certainly beats phasing through walls... -Dimi | ||
| 7957 | 407 | } | |
| 7958 | |||
| 7959 | ok: | ||
| 7960 | 266195 | dir = ndir; | |
| 7961 | 286994 | } | |
| 7962 | |||
| 7963 | 940 | void enemy::newdir() | |
| 7964 | { | ||
| 7965 | 940 | newdir(4,0,spw_none); | |
| 7966 | 940 | } | |
| 7967 | |||
| 7968 | ✗ | zfix enemy::distance_left() | |
| 7969 | { | ||
| 7970 | ✗ | int32_t a2=x.getInt(); | |
| 7971 | ✗ | int32_t b2=y.getInt(); | |
| 7972 | |||
| 7973 | ✗ | switch(dir) | |
| 7974 | { | ||
| 7975 | case up: | ||
| 7976 | ✗ | return (zfix)(b2&0xF); | |
| 7977 | |||
| 7978 | case down: | ||
| 7979 | ✗ | return (zfix)(16-(b2&0xF)); | |
| 7980 | |||
| 7981 | case left: | ||
| 7982 | ✗ | return (zfix)(a2&0xF); | |
| 7983 | |||
| 7984 | case right: | ||
| 7985 | ✗ | return (zfix)(16-(a2&0xF)); | |
| 7986 | } | ||
| 7987 | |||
| 7988 | ✗ | return (zfix)0; | |
| 7989 | ✗ | } | |
| 7990 | |||
| 7991 | // keeps walking around | ||
| 7992 | 223798 | void enemy::constant_walk(int32_t newrate,int32_t newhoming,int32_t special) | |
| 7993 | { | ||
| 7994 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 223798 times.
|
223798 | if(slide()) |
| 7995 | ✗ | return; | |
| 7996 | |||
| 7997 |
8/12✓ Branch 0 taken 221555 times.
✓ Branch 1 taken 2243 times.
✓ Branch 2 taken 221555 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 219690 times.
✓ Branch 5 taken 1865 times.
✓ Branch 6 taken 219690 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 219690 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 219690 times.
|
223798 | if(clk<0 || dying || stunclk || watch || ceiling || frozenclock ) |
| 7998 | 4108 | return; | |
| 7999 | |||
| 8000 |
2/2✓ Branch 0 taken 15245 times.
✓ Branch 1 taken 204445 times.
|
219690 | if(clk3<=0) |
| 8001 | { | ||
| 8002 | 15245 | fix_coords(true); | |
| 8003 | 15245 | newdir(newrate,newhoming,special); | |
| 8004 | |||
| 8005 |
1/2✓ Branch 0 taken 15245 times.
✗ Branch 1 not taken.
|
15245 | if(step==0) |
| 8006 | ✗ | clk3=0; | |
| 8007 | else | ||
| 8008 | 15245 | clk3=int32_t(16.0/step); | |
| 8009 | 15245 | } | |
| 8010 |
2/2✓ Branch 0 taken 204424 times.
✓ Branch 1 taken 21 times.
|
204445 | else if(scored) |
| 8011 | { | ||
| 8012 | 21 | dir^=1; | |
| 8013 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | if (step != 0) clk3=int32_t(16.0/step)-clk3; |
| 8014 | ✗ | else clk3=32767; | |
| 8015 | 21 | } | |
| 8016 | |||
| 8017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 219690 times.
|
219690 | if (step != 0) --clk3; |
| 8018 | 219690 | move(step); | |
| 8019 | 223798 | } | |
| 8020 | |||
| 8021 | ✗ | void enemy::constant_walk() | |
| 8022 | { | ||
| 8023 | ✗ | constant_walk(4,0,spw_none); | |
| 8024 | ✗ | } | |
| 8025 | |||
| 8026 | 18230 | int32_t enemy::pos(int32_t newx,int32_t newy) | |
| 8027 | { | ||
| 8028 | 18230 | return (newy<<8)+newx; | |
| 8029 | } | ||
| 8030 | |||
| 8031 | // for variable step rates | ||
| 8032 | 234267 | void enemy::variable_walk(int32_t newrate,int32_t newhoming,int32_t special) | |
| 8033 | { | ||
| 8034 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 234267 times.
|
234267 | if(slide()) |
| 8035 | ✗ | return; | |
| 8036 | |||
| 8037 |
10/14✓ Branch 0 taken 234267 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 234267 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 228560 times.
✓ Branch 5 taken 5707 times.
✓ Branch 6 taken 221271 times.
✓ Branch 7 taken 7289 times.
✓ Branch 8 taken 200047 times.
✓ Branch 9 taken 21224 times.
✓ Branch 10 taken 200047 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 200047 times.
✗ Branch 13 not taken.
|
234267 | if(clk<0 || dying || stunclk || watch || step == 0 || ceiling || frozenclock ) |
| 8038 | 34220 | return; | |
| 8039 | |||
| 8040 | 200047 | zfix dx = (zfix)0; | |
| 8041 | 200047 | zfix dy = (zfix)0; | |
| 8042 | |||
| 8043 |
5/9✓ Branch 0 taken 43624 times.
✓ Branch 1 taken 44366 times.
✓ Branch 2 taken 53763 times.
✓ Branch 3 taken 56539 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1755 times.
|
200047 | switch(dir) |
| 8044 | { | ||
| 8045 | case 8: | ||
| 8046 | case up: | ||
| 8047 | 43624 | dy-=step; | |
| 8048 | 43624 | break; | |
| 8049 | |||
| 8050 | case 12: | ||
| 8051 | case down: | ||
| 8052 | 44366 | dy+=step; | |
| 8053 | 44366 | break; | |
| 8054 | |||
| 8055 | case 14: | ||
| 8056 | case left: | ||
| 8057 | 53763 | dx-=step; | |
| 8058 | 53763 | break; | |
| 8059 | |||
| 8060 | case 10: | ||
| 8061 | case right: | ||
| 8062 | 56539 | dx+=step; | |
| 8063 | 56539 | break; | |
| 8064 | |||
| 8065 | case 15: | ||
| 8066 | case l_up: | ||
| 8067 | ✗ | dx-=step; | |
| 8068 | ✗ | dy-=step; | |
| 8069 | ✗ | break; | |
| 8070 | |||
| 8071 | case 9: | ||
| 8072 | case r_up: | ||
| 8073 | ✗ | dx+=step; | |
| 8074 | ✗ | dy-=step; | |
| 8075 | ✗ | break; | |
| 8076 | |||
| 8077 | case 13: | ||
| 8078 | case l_down: | ||
| 8079 | ✗ | dx-=step; | |
| 8080 | ✗ | dy+=step; | |
| 8081 | ✗ | break; | |
| 8082 | |||
| 8083 | case 11: | ||
| 8084 | case r_down: | ||
| 8085 | ✗ | dx+=step; | |
| 8086 | ✗ | dy+=step; | |
| 8087 | ✗ | break; | |
| 8088 | } | ||
| 8089 | |||
| 8090 |
8/8✓ Branch 0 taken 95284 times.
✓ Branch 1 taken 104763 times.
✓ Branch 2 taken 12002 times.
✓ Branch 3 taken 83282 times.
✓ Branch 4 taken 5443 times.
✓ Branch 5 taken 6559 times.
✓ Branch 6 taken 193819 times.
✓ Branch 7 taken 6228 times.
|
200047 | if(((int32_t(x)&15)==0 && (int32_t(y)&15)==0 && clk3!=pos(x,y)) || |
| 8091 | 194604 | m_walkflag(int32_t(x+dx),int32_t(y+dy), spw_halfstep, dir)) | |
| 8092 | { | ||
| 8093 | 6228 | fix_coords(); | |
| 8094 | 6228 | newdir(newrate,newhoming,special); | |
| 8095 | 6228 | clk3=pos(x,y); | |
| 8096 | 6228 | } | |
| 8097 | |||
| 8098 | 200047 | move(step); | |
| 8099 | 234267 | } | |
| 8100 | |||
| 8101 | // pauses for a while after it makes a complete move (to a new square) | ||
| 8102 | 6920724 | void enemy::halting_walk(int32_t newrate,int32_t newhoming,int32_t special,int32_t newhrate, int32_t haltcnt) | |
| 8103 | { | ||
| 8104 |
4/4✓ Branch 0 taken 39782 times.
✓ Branch 1 taken 6880942 times.
✓ Branch 2 taken 32151 times.
✓ Branch 3 taken 7631 times.
|
6920724 | if(sclk && clk2) |
| 8105 | { | ||
| 8106 | 7631 | clk3=0; | |
| 8107 | 7631 | } | |
| 8108 | |||
| 8109 |
11/14✓ Branch 0 taken 6885788 times.
✓ Branch 1 taken 34936 times.
✓ Branch 2 taken 6885788 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6885788 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6623943 times.
✓ Branch 7 taken 261845 times.
✓ Branch 8 taken 6500231 times.
✓ Branch 9 taken 123712 times.
✓ Branch 10 taken 6498459 times.
✓ Branch 11 taken 1772 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 6498459 times.
|
6920724 | if(slide() || clk<0 || dying || stunclk || watch || ceiling || frozenclock) |
| 8110 | { | ||
| 8111 | 422265 | return; | |
| 8112 | } | ||
| 8113 | |||
| 8114 |
2/2✓ Branch 0 taken 1304856 times.
✓ Branch 1 taken 5193603 times.
|
6498459 | if(clk2>0) |
| 8115 | { | ||
| 8116 | 1304856 | --clk2; | |
| 8117 | 1304856 | return; | |
| 8118 | } | ||
| 8119 | |||
| 8120 |
2/2✓ Branch 0 taken 227998 times.
✓ Branch 1 taken 4965605 times.
|
5193603 | if(clk3<=0) |
| 8121 | { | ||
| 8122 | 227998 | fix_coords(true); | |
| 8123 | 227998 | newdir(newrate,newhoming,special); | |
| 8124 | 227998 | clk3=int32_t(16.0/step); | |
| 8125 |
2/2✓ Branch 0 taken 227989 times.
✓ Branch 1 taken 9 times.
|
227998 | if (step == 0) clk3 = 32767; //It used to return this in 2.53 and I'm unsure why; I'm guessing dividing by 0 gave max int? Either way, can't be 0 here or scripts break. |
| 8126 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 227998 times.
|
227998 | if(clk2<0) |
| 8127 | { | ||
| 8128 | ✗ | clk2=0; | |
| 8129 | ✗ | } | |
| 8130 |
2/2✓ Branch 0 taken 32198 times.
✓ Branch 1 taken 195800 times.
|
227998 | else if((zc_oldrand()&15)<newhrate) |
| 8131 | { | ||
| 8132 | 32198 | clk2=haltcnt; | |
| 8133 | 32198 | return; | |
| 8134 | } | ||
| 8135 | 195800 | } | |
| 8136 |
2/2✓ Branch 0 taken 4964255 times.
✓ Branch 1 taken 1350 times.
|
4965605 | else if(scored) |
| 8137 | { | ||
| 8138 | 1350 | dir^=1; | |
| 8139 | |||
| 8140 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1349 times.
|
1350 | if (step != 0) clk3=int32_t(16.0/step)-clk3; |
| 8141 | 1 | else clk3=32767; | |
| 8142 | 1350 | } | |
| 8143 | |||
| 8144 |
2/2✓ Branch 0 taken 12025 times.
✓ Branch 1 taken 5149380 times.
|
5161405 | if (step != 0) --clk3; |
| 8145 | 5161405 | move(step); | |
| 8146 | 6920724 | } | |
| 8147 | |||
| 8148 | // 8-directional movement, aligns to 8 pixels | ||
| 8149 | ✗ | void enemy::constant_walk_8(int32_t newrate,int32_t newhoming,int32_t special) | |
| 8150 | { | ||
| 8151 | ✗ | if(clk<0 || dying || stunclk || watch || ceiling || frozenclock) | |
| 8152 | ✗ | return; | |
| 8153 | |||
| 8154 | ✗ | if(clk3<=0) | |
| 8155 | { | ||
| 8156 | ✗ | newdir_8(newrate,newhoming,special); | |
| 8157 | ✗ | clk3=int32_t(8.0/step); | |
| 8158 | ✗ | if (step == 0) clk3 = 32767; | |
| 8159 | ✗ | } | |
| 8160 | |||
| 8161 | ✗ | if (step != 0) --clk3; | |
| 8162 | ✗ | move(step); | |
| 8163 | ✗ | } | |
| 8164 | // 8-directional movement, aligns to 8 pixels | ||
| 8165 | 78326 | void enemy::constant_walk_8_old(int32_t newrate,int32_t newhoming,int32_t special) | |
| 8166 | { | ||
| 8167 |
6/12✓ Branch 0 taken 78326 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 78326 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 78326 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 78326 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 78326 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 78326 times.
|
78326 | if(clk<0 || dying || stunclk || watch || ceiling || frozenclock) |
| 8168 | ✗ | return; | |
| 8169 | |||
| 8170 |
2/2✓ Branch 0 taken 72597 times.
✓ Branch 1 taken 5729 times.
|
78326 | if(clk3<=0) |
| 8171 | { | ||
| 8172 | 5729 | newdir_8(newrate,newhoming,special); | |
| 8173 | 5729 | clk3=int32_t(8.0/step); | |
| 8174 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5729 times.
|
5729 | if (step == 0) clk3 = 32767; |
| 8175 | 5729 | } | |
| 8176 | |||
| 8177 |
1/2✓ Branch 0 taken 78326 times.
✗ Branch 1 not taken.
|
78326 | if (step != 0) --clk3; |
| 8178 | 78326 | move(step); | |
| 8179 | 78326 | } | |
| 8180 | |||
| 8181 | ✗ | void enemy::halting_walk_8(int32_t newrate,int32_t newhoming, int32_t newclk,int32_t special,int32_t newhrate, int32_t haltcnt) | |
| 8182 | { | ||
| 8183 | ✗ | if(clk<0 || dying || stunclk || watch || frozenclock) | |
| 8184 | ✗ | return; | |
| 8185 | |||
| 8186 | ✗ | if(!canmove(dir,step,special,false)) | |
| 8187 | ✗ | clk3=0; | |
| 8188 | |||
| 8189 | ✗ | if(clk2>0) | |
| 8190 | { | ||
| 8191 | ✗ | --clk2; | |
| 8192 | ✗ | return; | |
| 8193 | } | ||
| 8194 | |||
| 8195 | ✗ | if(clk3<=0) | |
| 8196 | { | ||
| 8197 | ✗ | newdir_8(newrate,newhoming,special); | |
| 8198 | ✗ | clk3=newclk; | |
| 8199 | |||
| 8200 | ✗ | if(clk2<0) | |
| 8201 | { | ||
| 8202 | ✗ | clk2=0; | |
| 8203 | ✗ | } | |
| 8204 | ✗ | else if((zc_oldrand()&15)<newhrate) | |
| 8205 | { | ||
| 8206 | ✗ | newdir_8(newrate,newhoming,special); | |
| 8207 | ✗ | clk2=haltcnt; | |
| 8208 | ✗ | return; | |
| 8209 | } | ||
| 8210 | ✗ | } | |
| 8211 | |||
| 8212 | ✗ | --clk3; | |
| 8213 | ✗ | move(step); | |
| 8214 | ✗ | } | |
| 8215 | |||
| 8216 | // 8-directional movement, no alignment | ||
| 8217 | 2289696 | void enemy::variable_walk_8(int32_t newrate,int32_t newhoming, int32_t newclk,int32_t special) | |
| 8218 | { | ||
| 8219 |
9/12✓ Branch 0 taken 2195791 times.
✓ Branch 1 taken 93905 times.
✓ Branch 2 taken 2195791 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2174298 times.
✓ Branch 5 taken 21493 times.
✓ Branch 6 taken 2164627 times.
✓ Branch 7 taken 9671 times.
✓ Branch 8 taken 2164627 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2164627 times.
|
2289696 | if(clk<0 || dying || stunclk || watch || ceiling || frozenclock) |
| 8220 | 125069 | return; | |
| 8221 | |||
| 8222 |
2/2✓ Branch 0 taken 2149056 times.
✓ Branch 1 taken 15571 times.
|
2164627 | if(!canmove(dir,step,special,false)) |
| 8223 | 15571 | clk3=0; | |
| 8224 | |||
| 8225 |
2/2✓ Branch 0 taken 1890416 times.
✓ Branch 1 taken 274211 times.
|
2164627 | if(clk3<=0) |
| 8226 | { | ||
| 8227 | 274211 | newdir_8(newrate,newhoming,special); | |
| 8228 | 274211 | clk3=newclk; | |
| 8229 | 274211 | } | |
| 8230 | |||
| 8231 | 2164627 | --clk3; | |
| 8232 | 2164627 | move(step); | |
| 8233 | 2289696 | } | |
| 8234 | |||
| 8235 | // same as above but with variable enemy size | ||
| 8236 | 51782 | void enemy::variable_walk_8(int32_t newrate,int32_t newhoming, int32_t newclk,int32_t special,int32_t dx1,int32_t dy1,int32_t dx2,int32_t dy2) | |
| 8237 | { | ||
| 8238 |
8/12✓ Branch 0 taken 51015 times.
✓ Branch 1 taken 767 times.
✓ Branch 2 taken 51015 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 51015 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 50964 times.
✓ Branch 7 taken 51 times.
✓ Branch 8 taken 50964 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 50964 times.
|
51782 | if(clk<0 || dying || stunclk || watch || ceiling || frozenclock) |
| 8239 | 818 | return; | |
| 8240 | |||
| 8241 |
2/2✓ Branch 0 taken 50457 times.
✓ Branch 1 taken 507 times.
|
50964 | if(!canmove(dir,step,special,dx1,dy1,dx2,dy2,false)) |
| 8242 | 507 | clk3=0; | |
| 8243 | |||
| 8244 |
2/2✓ Branch 0 taken 47537 times.
✓ Branch 1 taken 3427 times.
|
50964 | if(clk3<=0) |
| 8245 | { | ||
| 8246 | 3427 | newdir_8(newrate,newhoming,special,dx1,dy1,dx2,dy2); | |
| 8247 | 3427 | clk3=newclk; | |
| 8248 | 3427 | } | |
| 8249 | |||
| 8250 | 50964 | --clk3; | |
| 8251 | 50964 | move(step); | |
| 8252 | 51782 | } | |
| 8253 | |||
| 8254 | // the variable speed floater movement | ||
| 8255 | // ms is max speed | ||
| 8256 | // ss is step speed | ||
| 8257 | // s is step count | ||
| 8258 | // p is pause count | ||
| 8259 | // g is graduality :) | ||
| 8260 | //floater_walk(rate,hrate,dstep/100,(zfix)0,10,dmisc16,dmisc17); | ||
| 8261 | 1894781 | void enemy::floater_walk(int32_t newrate,int32_t newclk,zfix ms,zfix ss,int32_t s,int32_t p, int32_t g) | |
| 8262 | { | ||
| 8263 | 1894781 | ++clk2; | |
| 8264 | 1894781 | byte over_pit = overpit(this); | |
| 8265 | |||
| 8266 |
4/4✓ Branch 0 taken 410894 times.
✓ Branch 1 taken 1483887 times.
✓ Branch 2 taken 410627 times.
✓ Branch 3 taken 267 times.
|
1894781 | if(dmisc1 && over_pit) p = 0; |
| 8267 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 34860 times.
✓ Branch 2 taken 733207 times.
✓ Branch 3 taken 1047617 times.
✓ Branch 4 taken 79097 times.
|
1894781 | switch(movestatus) |
| 8268 | { | ||
| 8269 | //! This needs a case 4 (landing)....if we want to halt, we move to case 4, and | ||
| 8270 | //! if the conditions prevent it, we jump back to case 2. | ||
| 8271 | case 0: // paused | ||
| 8272 |
2/2✓ Branch 0 taken 34205 times.
✓ Branch 1 taken 655 times.
|
34860 | if(clk2>=p) |
| 8273 | { | ||
| 8274 | 655 | movestatus=1; | |
| 8275 | 655 | clk2=0; | |
| 8276 | 655 | } | |
| 8277 | |||
| 8278 | 34860 | break; | |
| 8279 | |||
| 8280 | case 1: // speeding up | ||
| 8281 |
1/2✓ Branch 0 taken 733207 times.
✗ Branch 1 not taken.
|
733207 | if (s >= 0) |
| 8282 | { | ||
| 8283 |
2/2✓ Branch 0 taken 728260 times.
✓ Branch 1 taken 4947 times.
|
733207 | if(clk2<g*s) |
| 8284 | { | ||
| 8285 |
2/2✓ Branch 0 taken 681672 times.
✓ Branch 1 taken 46588 times.
|
728260 | if(!((clk2-1)%g)) |
| 8286 | 46588 | step+=ss; | |
| 8287 | 728260 | } | |
| 8288 | else | ||
| 8289 | { | ||
| 8290 | 4947 | movestatus=2; | |
| 8291 | 4947 | clk2=0; | |
| 8292 | } | ||
| 8293 | 733207 | } | |
| 8294 | else | ||
| 8295 | { | ||
| 8296 | ✗ | if(step < ms) | |
| 8297 | { | ||
| 8298 | ✗ | if(!((clk2-1)%g)) | |
| 8299 | { | ||
| 8300 | ✗ | step+=ss; | |
| 8301 | ✗ | if (step >= ms) step = ms; | |
| 8302 | ✗ | } | |
| 8303 | ✗ | } | |
| 8304 | else | ||
| 8305 | { | ||
| 8306 | ✗ | step = ms; | |
| 8307 | ✗ | movestatus=2; | |
| 8308 | ✗ | clk2=0; | |
| 8309 | } | ||
| 8310 | } | ||
| 8311 | |||
| 8312 | 733207 | break; | |
| 8313 | |||
| 8314 | case 2: // normal | ||
| 8315 | 1047617 | step=ms; | |
| 8316 | |||
| 8317 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 1047617 times.
✓ Branch 2 taken 213965 times.
✓ Branch 3 taken 833652 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 833652 times.
✓ Branch 6 taken 832554 times.
✓ Branch 7 taken 1098 times.
|
1047617 | if(clk2>(dmisc15>0?dmisc15:48) && !(zc_oldrand()%(dmisc14>0?dmisc14:768))) |
| 8318 | { | ||
| 8319 |
1/2✓ Branch 0 taken 1098 times.
✗ Branch 1 not taken.
|
1098 | if (s >= 0) step=ss*s; |
| 8320 | ✗ | else step=ms; | |
| 8321 | 1098 | movestatus=3; | |
| 8322 | 1098 | clk2=0; | |
| 8323 | 1098 | } | |
| 8324 | |||
| 8325 | 1047617 | break; | |
| 8326 | |||
| 8327 | case 3: // slowing down | ||
| 8328 |
1/2✓ Branch 0 taken 79097 times.
✗ Branch 1 not taken.
|
79097 | if (s >= 0) |
| 8329 | { | ||
| 8330 |
2/2✓ Branch 0 taken 78318 times.
✓ Branch 1 taken 779 times.
|
79097 | if(clk2<=g*s) |
| 8331 | { | ||
| 8332 | { //don't slow down over pits | ||
| 8333 | |||
| 8334 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 78306 times.
|
78318 | if(over_pit) |
| 8335 | { | ||
| 8336 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if(dmisc1) |
| 8337 | { | ||
| 8338 | ✗ | step=ms; | |
| 8339 | ✗ | } | |
| 8340 | 12 | } | |
| 8341 | else //can slow down | ||
| 8342 | { | ||
| 8343 |
4/4✓ Branch 0 taken 4858 times.
✓ Branch 1 taken 73448 times.
✓ Branch 2 taken 4586 times.
✓ Branch 3 taken 272 times.
|
78306 | if(!(clk2%g) && !dmisc1) |
| 8344 | 4586 | step-=ss; | |
| 8345 | } | ||
| 8346 | } | ||
| 8347 | |||
| 8348 | |||
| 8349 | 78318 | } | |
| 8350 | else | ||
| 8351 | { | ||
| 8352 | //if((moveflags&FLAG_CAN_PITFALL)) //don't check pits if the enemy ignores them | ||
| 8353 | //this doesn't help keese, as they have a z of 0. | ||
| 8354 | //they always nee to run this check. | ||
| 8355 | { | ||
| 8356 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 779 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
779 | if(over_pit &&!dmisc1) |
| 8357 | { | ||
| 8358 | ✗ | --clk2; //if over a pit, don't land, and revert clock change | |
| 8359 | ✗ | } | |
| 8360 | else //can land safely | ||
| 8361 | { | ||
| 8362 | 779 | movestatus=0; | |
| 8363 |
3/4✓ Branch 0 taken 446 times.
✓ Branch 1 taken 333 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 446 times.
|
779 | if(dmisc1&&!over_pit) |
| 8364 | 446 | step=0; | |
| 8365 | 779 | clk2=0; | |
| 8366 | } | ||
| 8367 | } | ||
| 8368 | |||
| 8369 | } | ||
| 8370 | 79097 | } | |
| 8371 | else | ||
| 8372 | { | ||
| 8373 | ✗ | if(step > 0) | |
| 8374 | { | ||
| 8375 | ✗ | if(over_pit) | |
| 8376 | { | ||
| 8377 | ✗ | if(dmisc1) | |
| 8378 | { | ||
| 8379 | ✗ | step=ms; | |
| 8380 | ✗ | } | |
| 8381 | ✗ | } | |
| 8382 | else //can slow down | ||
| 8383 | { | ||
| 8384 | ✗ | if(!(clk2%g)) | |
| 8385 | ✗ | step-=ss; | |
| 8386 | } | ||
| 8387 | ✗ | } | |
| 8388 | else | ||
| 8389 | { | ||
| 8390 | //if((moveflags&FLAG_CAN_PITFALL)) //don't check pits if the enemy ignores them | ||
| 8391 | //this doesn't help keese, as they have a z of 0. | ||
| 8392 | //they always nee to run this check. | ||
| 8393 | ✗ | if(over_pit) | |
| 8394 | { | ||
| 8395 | ✗ | step+=ss; //if over a pit, don't land, and revert clock change | |
| 8396 | ✗ | } | |
| 8397 | else //can land safely | ||
| 8398 | { | ||
| 8399 | ✗ | movestatus=0; | |
| 8400 | ✗ | step=0; | |
| 8401 | ✗ | clk2=0; | |
| 8402 | } | ||
| 8403 | } | ||
| 8404 | } | ||
| 8405 | |||
| 8406 | 79097 | break; | |
| 8407 | } | ||
| 8408 | |||
| 8409 |
2/2✓ Branch 0 taken 1051466 times.
✓ Branch 1 taken 843315 times.
|
1894781 | variable_walk_8(movestatus==2?newrate:0,homing,newclk,spw_floater); |
| 8410 | 1894781 | } | |
| 8411 | |||
| 8412 | ✗ | void enemy::floater_walk(int32_t newrate,int32_t newclk,zfix s) | |
| 8413 | { | ||
| 8414 | ✗ | floater_walk(newrate,newclk,s,(zfix)0.125,3,80,32); | |
| 8415 | ✗ | } | |
| 8416 | |||
| 8417 | // Checks if enemy is lined up with Hero. If so, returns direction Hero is | ||
| 8418 | // at as compared to enemy. Returns -1 if not lined up. Range is inclusive. | ||
| 8419 | 474294 | int32_t enemy::lined_up(int32_t range, bool dir8) | |
| 8420 | { | ||
| 8421 | 474294 | int32_t lx = Hero.getX(); | |
| 8422 | 474294 | int32_t ly = Hero.getY(); | |
| 8423 | |||
| 8424 |
2/2✓ Branch 0 taken 18176 times.
✓ Branch 1 taken 456118 times.
|
474294 | if(abs(lx-int32_t(x))<=range) |
| 8425 | { | ||
| 8426 |
2/2✓ Branch 0 taken 7122 times.
✓ Branch 1 taken 11054 times.
|
18176 | if(ly<y) |
| 8427 | { | ||
| 8428 | 7122 | return up; | |
| 8429 | } | ||
| 8430 | |||
| 8431 | 11054 | return down; | |
| 8432 | } | ||
| 8433 | |||
| 8434 |
2/2✓ Branch 0 taken 21305 times.
✓ Branch 1 taken 434813 times.
|
456118 | if(abs(ly-int32_t(y))<=range) |
| 8435 | { | ||
| 8436 |
2/2✓ Branch 0 taken 10711 times.
✓ Branch 1 taken 10594 times.
|
21305 | if(lx<x) |
| 8437 | { | ||
| 8438 | 10711 | return left; | |
| 8439 | } | ||
| 8440 | |||
| 8441 | 10594 | return right; | |
| 8442 | } | ||
| 8443 | |||
| 8444 |
2/2✓ Branch 0 taken 87017 times.
✓ Branch 1 taken 347796 times.
|
434813 | if(dir8) |
| 8445 | { | ||
| 8446 |
2/2✓ Branch 0 taken 119146 times.
✓ Branch 1 taken 228650 times.
|
347796 | if(abs(lx-x)-abs(ly-y)<=range) |
| 8447 | //if(abs(lx-x)-abs(ly-y)<=range && abs(ly-y)-abs(lx-x)<=range) //Fix floating enemies not seeking hero. -Tamamo | ||
| 8448 | { | ||
| 8449 |
2/2✓ Branch 0 taken 52201 times.
✓ Branch 1 taken 66945 times.
|
119146 | if(ly<y) |
| 8450 | { | ||
| 8451 |
2/2✓ Branch 0 taken 30148 times.
✓ Branch 1 taken 22053 times.
|
52201 | if(lx<x) |
| 8452 | { | ||
| 8453 | 30148 | return l_up; | |
| 8454 | } | ||
| 8455 | else | ||
| 8456 | { | ||
| 8457 | 22053 | return r_up; | |
| 8458 | } | ||
| 8459 | } | ||
| 8460 | else | ||
| 8461 | { | ||
| 8462 |
2/2✓ Branch 0 taken 32948 times.
✓ Branch 1 taken 33997 times.
|
66945 | if(lx<x) |
| 8463 | { | ||
| 8464 | 33997 | return l_down; | |
| 8465 | } | ||
| 8466 | else | ||
| 8467 | { | ||
| 8468 | 32948 | return r_down; | |
| 8469 | } | ||
| 8470 | } | ||
| 8471 | } | ||
| 8472 | 228650 | } | |
| 8473 | |||
| 8474 | 315667 | return -1; | |
| 8475 | 474294 | } | |
| 8476 | |||
| 8477 | // returns true if Hero is within 'range' pixels of the enemy | ||
| 8478 | 13649 | bool enemy::HeroInRange(int32_t range) | |
| 8479 | { | ||
| 8480 | 13649 | int32_t lx = Hero.getX(); | |
| 8481 | 13649 | int32_t ly = Hero.getY(); | |
| 8482 |
2/2✓ Branch 0 taken 11420 times.
✓ Branch 1 taken 2229 times.
|
13649 | return abs(lx-int32_t(x))<=range && abs(ly-int32_t(y))<=range; |
| 8483 | } | ||
| 8484 | |||
| 8485 | // place the enemy in line with Hero (red wizzrobes) | ||
| 8486 | 2280 | void enemy::place_on_axis(bool floater, bool solid_ok) | |
| 8487 | { | ||
| 8488 |
6/6✓ Branch 0 taken 1881 times.
✓ Branch 1 taken 399 times.
✓ Branch 2 taken 2081 times.
✓ Branch 3 taken 199 times.
✓ Branch 4 taken 1682 times.
✓ Branch 5 taken 399 times.
|
2280 | int32_t lx=zc_min(zc_max(int32_t(Hero.getX())&0xF0,32),208); |
| 8489 |
6/6✓ Branch 0 taken 1905 times.
✓ Branch 1 taken 375 times.
✓ Branch 2 taken 1944 times.
✓ Branch 3 taken 336 times.
✓ Branch 4 taken 1569 times.
✓ Branch 5 taken 375 times.
|
2280 | int32_t ly=zc_min(zc_max(int32_t(Hero.getY())&0xF0,32),128); |
| 8490 | 2280 | int32_t pos2=zc_oldrand()%23; | |
| 8491 | 2280 | int32_t tried=0; | |
| 8492 | 2280 | bool last_resort,placed=false; | |
| 8493 | |||
| 8494 | |||
| 8495 | 2280 | do | |
| 8496 | { | ||
| 8497 |
2/2✓ Branch 0 taken 2384 times.
✓ Branch 1 taken 1681 times.
|
4065 | if(pos2<14) |
| 8498 | { | ||
| 8499 | 2384 | x=(pos2<<4)+16; | |
| 8500 | 2384 | y=ly; | |
| 8501 | 2384 | } | |
| 8502 | else | ||
| 8503 | { | ||
| 8504 | 1681 | x=lx; | |
| 8505 | 1681 | y=((pos2-14)<<4)+16; | |
| 8506 | } | ||
| 8507 | |||
| 8508 | // Don't commit to a last resort if position is out of bounds. | ||
| 8509 |
6/6✓ Branch 0 taken 3903 times.
✓ Branch 1 taken 162 times.
✓ Branch 2 taken 3745 times.
✓ Branch 3 taken 158 times.
✓ Branch 4 taken 126 times.
✓ Branch 5 taken 3619 times.
|
4065 | last_resort= !(x<32 || y<32 || x>=224 || y>=144); |
| 8510 | |||
| 8511 |
4/4✓ Branch 0 taken 2113 times.
✓ Branch 1 taken 1952 times.
✓ Branch 2 taken 3716 times.
✓ Branch 3 taken 2095 times.
|
4065 | if(abs(lx-int32_t(x))>16 || abs(ly-int32_t(y))>16) |
| 8512 | { | ||
| 8513 | // Red Wizzrobes should be able to appear on water, but not other | ||
| 8514 | // solid combos; however, they could appear on solid combos in 2.10, | ||
| 8515 | // and some quests depend on that. | ||
| 8516 |
4/4✓ Branch 0 taken 2140 times.
✓ Branch 1 taken 3528 times.
✓ Branch 2 taken 1248 times.
✓ Branch 3 taken 2280 times.
|
5668 | if((solid_ok || !m_walkflag(x,y,floater ? spw_water : spw_door, dir)) |
| 8517 | 5668 | && !flyerblocked(x,y,floater ? spw_floater : spw_door)) | |
| 8518 | 2280 | placed=true; | |
| 8519 | 5668 | } | |
| 8520 | |||
| 8521 |
3/6✓ Branch 0 taken 1785 times.
✓ Branch 1 taken 3482 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1785 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5267 | if(!placed && tried>=22 && last_resort) |
| 8522 | { | ||
| 8523 | ✗ | placed=true; | |
| 8524 | ✗ | } | |
| 8525 | |||
| 8526 | 5267 | ++tried; | |
| 8527 | 5267 | pos2=(pos2+3)%23; | |
| 8528 |
2/2✓ Branch 0 taken 1785 times.
✓ Branch 1 taken 3482 times.
|
5267 | } |
| 8529 | 5267 | while(!placed); | |
| 8530 | |||
| 8531 |
2/2✓ Branch 0 taken 2651 times.
✓ Branch 1 taken 831 times.
|
3482 | if(y==ly) |
| 8532 | 2651 | dir=(x<lx)?right:left; | |
| 8533 | else | ||
| 8534 | 831 | dir=(y<ly)?down:up; | |
| 8535 | |||
| 8536 | 3482 | clk2=tried; | |
| 8537 | 3482 | } | |
| 8538 | |||
| 8539 | 9171439 | int32_t enemy::n_frame_n_dir(int32_t frames, int32_t ndir, int32_t f4) | |
| 8540 | { | ||
| 8541 | 9171439 | int32_t t = o_tile; | |
| 8542 | 9171439 | int32_t b = o_tile; | |
| 8543 | |||
| 8544 | // Darknuts, but also Wizzrobes and Wallmasters | ||
| 8545 |
3/4✓ Branch 0 taken 3375265 times.
✓ Branch 1 taken 5453811 times.
✓ Branch 2 taken 342363 times.
✗ Branch 3 not taken.
|
9171439 | switch(family) |
| 8546 | { | ||
| 8547 | case eeWALK: | ||
| 8548 |
5/6✓ Branch 0 taken 369324 times.
✓ Branch 1 taken 5084487 times.
✓ Branch 2 taken 261311 times.
✓ Branch 3 taken 108013 times.
✓ Branch 4 taken 261311 times.
✗ Branch 5 not taken.
|
5453811 | if(dmisc9==e9tPOLSVOICE && clk2>=0 && do_animation) |
| 8549 | { | ||
| 8550 | 261311 | tile=s_tile; | |
| 8551 | 261311 | t=s_tile; | |
| 8552 | 261311 | b=s_tile; | |
| 8553 | 261311 | } | |
| 8554 | |||
| 8555 | 5453811 | break; | |
| 8556 | |||
| 8557 | case eeTRAP: | ||
| 8558 |
4/6✓ Branch 0 taken 121158 times.
✓ Branch 1 taken 221205 times.
✓ Branch 2 taken 121158 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 121158 times.
|
342363 | if(dummy_int[1] && guysbuf[id].flags2 & eneflag_trp2 && do_animation) // Just to make sure |
| 8559 | { | ||
| 8560 | 121158 | tile=s_tile; | |
| 8561 | 121158 | t=s_tile; | |
| 8562 | 121158 | b=s_tile; | |
| 8563 | 121158 | } | |
| 8564 | |||
| 8565 | 342363 | break; | |
| 8566 | |||
| 8567 | case eeSPINTILE: | ||
| 8568 | ✗ | if(misc>=96 && do_animation) | |
| 8569 | { | ||
| 8570 | ✗ | tile=o_tile+frames*ndir; | |
| 8571 | ✗ | t=tile; | |
| 8572 | ✗ | } | |
| 8573 | |||
| 8574 | ✗ | break; | |
| 8575 | } | ||
| 8576 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9171439 times.
|
9171439 | if ( do_animation ) |
| 8577 | { | ||
| 8578 |
4/6✓ Branch 0 taken 163042 times.
✓ Branch 1 taken 9008397 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 133804 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8874593 times.
|
9171439 | if(ndir!=0) switch(frames) |
| 8579 | { | ||
| 8580 | case 2: | ||
| 8581 | 133804 | tiledir_small(dir,ndir==4); | |
| 8582 | 133804 | break; | |
| 8583 | |||
| 8584 | case 3: | ||
| 8585 | ✗ | tiledir_three(dir); | |
| 8586 | ✗ | break; | |
| 8587 | |||
| 8588 | case 4: | ||
| 8589 | 8874593 | tiledir(dir,ndir==4); | |
| 8590 | 8874593 | break; | |
| 8591 | 9008397 | } | |
| 8592 | |||
| 8593 |
2/2✓ Branch 0 taken 5453811 times.
✓ Branch 1 taken 3717628 times.
|
9171439 | if(family==eeWALK) |
| 8594 |
6/6✓ Branch 0 taken 4340892 times.
✓ Branch 1 taken 1112919 times.
✓ Branch 2 taken 4094853 times.
✓ Branch 3 taken 1358958 times.
✓ Branch 4 taken 1072833 times.
✓ Branch 5 taken 286125 times.
|
5453811 | tile=zc_min(tile+f4, t+frames*(zc_max(dir, 0)+1)-1); |
| 8595 | else | ||
| 8596 | 3717628 | tile+=f4; | |
| 8597 | 9171439 | } | |
| 8598 | 9171439 | return b; | |
| 8599 | } | ||
| 8600 | |||
| 8601 | ✗ | void enemy::tiledir_three(int32_t ndir) | |
| 8602 | { | ||
| 8603 | ✗ | if ( !do_animation ) return; | |
| 8604 | ✗ | flip=0; | |
| 8605 | |||
| 8606 | ✗ | switch(ndir) | |
| 8607 | { | ||
| 8608 | case right: | ||
| 8609 | ✗ | tile+=3; | |
| 8610 | [[fallthrough]]; | ||
| 8611 | |||
| 8612 | case left: | ||
| 8613 | ✗ | tile+=3; | |
| 8614 | [[fallthrough]]; | ||
| 8615 | |||
| 8616 | case down: | ||
| 8617 | ✗ | tile+=3; | |
| 8618 | [[fallthrough]]; | ||
| 8619 | |||
| 8620 | case up: | ||
| 8621 | ✗ | break; | |
| 8622 | } | ||
| 8623 | ✗ | } | |
| 8624 | |||
| 8625 | 133804 | void enemy::tiledir_small(int32_t ndir, bool fourdir) | |
| 8626 | { | ||
| 8627 |
1/2✓ Branch 0 taken 133804 times.
✗ Branch 1 not taken.
|
133804 | if ( !do_animation ) return; |
| 8628 | 133804 | flip=0; | |
| 8629 | |||
| 8630 |
8/9✓ Branch 0 taken 27396 times.
✓ Branch 1 taken 27200 times.
✓ Branch 2 taken 35010 times.
✓ Branch 3 taken 36308 times.
✓ Branch 4 taken 2126 times.
✓ Branch 5 taken 1996 times.
✓ Branch 6 taken 2148 times.
✓ Branch 7 taken 1620 times.
✗ Branch 8 not taken.
|
133804 | switch(ndir) |
| 8631 | { | ||
| 8632 | case 8: | ||
| 8633 | case up: | ||
| 8634 | 27396 | break; | |
| 8635 | |||
| 8636 | case 12: | ||
| 8637 | case down: | ||
| 8638 | 27200 | tile+=2; | |
| 8639 | 27200 | break; | |
| 8640 | |||
| 8641 | case 14: | ||
| 8642 | case left: | ||
| 8643 | 35010 | tile+=4; | |
| 8644 | 35010 | break; | |
| 8645 | |||
| 8646 | case 10: | ||
| 8647 | case right: | ||
| 8648 | 36308 | tile+=6; | |
| 8649 | 36308 | break; | |
| 8650 | |||
| 8651 | case 9: | ||
| 8652 | case r_up: | ||
| 8653 |
1/2✓ Branch 0 taken 2126 times.
✗ Branch 1 not taken.
|
2126 | if(fourdir) |
| 8654 | 2126 | break; | |
| 8655 | |||
| 8656 | ✗ | tile+=10; | |
| 8657 | ✗ | break; | |
| 8658 | |||
| 8659 | case 11: | ||
| 8660 | case r_down: | ||
| 8661 |
1/2✓ Branch 0 taken 1996 times.
✗ Branch 1 not taken.
|
1996 | if(fourdir) |
| 8662 | 1996 | tile+=2; | |
| 8663 | else | ||
| 8664 | ✗ | tile+=14; | |
| 8665 | |||
| 8666 | 1996 | break; | |
| 8667 | |||
| 8668 | case 13: | ||
| 8669 | case l_down: | ||
| 8670 |
1/2✓ Branch 0 taken 2148 times.
✗ Branch 1 not taken.
|
2148 | if(fourdir) |
| 8671 | 2148 | tile+=2; | |
| 8672 | else | ||
| 8673 | ✗ | tile+=12; | |
| 8674 | |||
| 8675 | 2148 | break; | |
| 8676 | |||
| 8677 | case 15: | ||
| 8678 | case l_up: | ||
| 8679 |
1/2✓ Branch 0 taken 1620 times.
✗ Branch 1 not taken.
|
1620 | if(fourdir) |
| 8680 | 1620 | break; | |
| 8681 | |||
| 8682 | ✗ | tile+=8; | |
| 8683 | ✗ | break; | |
| 8684 | |||
| 8685 | default: | ||
| 8686 | //dir=(zc_oldrand()*100)%8; | ||
| 8687 | //tiledir_small(dir); | ||
| 8688 | // flip=zc_oldrand()&3; | ||
| 8689 | // tile=(zc_oldrand()*100000)%NEWMAXTILES; | ||
| 8690 | ✗ | break; | |
| 8691 | } | ||
| 8692 | 133804 | } | |
| 8693 | |||
| 8694 | 10360623 | void enemy::tiledir(int32_t ndir, bool fourdir) | |
| 8695 | { | ||
| 8696 |
1/2✓ Branch 0 taken 10360623 times.
✗ Branch 1 not taken.
|
10360623 | if ( !do_animation ) return; |
| 8697 | 10360623 | flip=0; | |
| 8698 | |||
| 8699 |
9/9✓ Branch 0 taken 2075292 times.
✓ Branch 1 taken 1794855 times.
✓ Branch 2 taken 2470737 times.
✓ Branch 3 taken 2375722 times.
✓ Branch 4 taken 371164 times.
✓ Branch 5 taken 447500 times.
✓ Branch 6 taken 434629 times.
✓ Branch 7 taken 382443 times.
✓ Branch 8 taken 8281 times.
|
10360623 | switch(ndir) |
| 8700 | { | ||
| 8701 | case 8: | ||
| 8702 | case up: | ||
| 8703 | 2075292 | break; | |
| 8704 | |||
| 8705 | case 12: | ||
| 8706 | case down: | ||
| 8707 | 1794855 | tile+=4; | |
| 8708 | 1794855 | break; | |
| 8709 | |||
| 8710 | case 14: | ||
| 8711 | case left: | ||
| 8712 | 2470737 | tile+=8; | |
| 8713 | 2470737 | break; | |
| 8714 | |||
| 8715 | case 10: | ||
| 8716 | case right: | ||
| 8717 | 2375722 | tile+=12; | |
| 8718 | 2375722 | break; | |
| 8719 | |||
| 8720 | case 9: | ||
| 8721 | case r_up: | ||
| 8722 |
2/2✓ Branch 0 taken 53890 times.
✓ Branch 1 taken 317274 times.
|
371164 | if(fourdir) |
| 8723 | 53890 | break; | |
| 8724 | else | ||
| 8725 | 317274 | tile+=24; | |
| 8726 | |||
| 8727 | 317274 | break; | |
| 8728 | |||
| 8729 | case 11: | ||
| 8730 | case r_down: | ||
| 8731 |
2/2✓ Branch 0 taken 58873 times.
✓ Branch 1 taken 388627 times.
|
447500 | if(fourdir) |
| 8732 | 58873 | tile+=4; | |
| 8733 | else | ||
| 8734 | 388627 | tile+=32; | |
| 8735 | |||
| 8736 | 447500 | break; | |
| 8737 | |||
| 8738 | case 13: | ||
| 8739 | case l_down: | ||
| 8740 |
2/2✓ Branch 0 taken 61462 times.
✓ Branch 1 taken 373167 times.
|
434629 | if(fourdir) |
| 8741 | 61462 | tile+=4; | |
| 8742 | else | ||
| 8743 | 373167 | tile+=28; | |
| 8744 | |||
| 8745 | 434629 | break; | |
| 8746 | |||
| 8747 | case 15: | ||
| 8748 | case l_up: | ||
| 8749 |
2/2✓ Branch 0 taken 46534 times.
✓ Branch 1 taken 335909 times.
|
382443 | if(fourdir) |
| 8750 | 46534 | break; | |
| 8751 | else | ||
| 8752 | 335909 | tile+=20; | |
| 8753 | |||
| 8754 | 335909 | break; | |
| 8755 | |||
| 8756 | default: | ||
| 8757 | //dir=(zc_oldrand()*100)%8; | ||
| 8758 | //tiledir(dir); | ||
| 8759 | // flip=zc_oldrand()&3; | ||
| 8760 | // tile=(zc_oldrand()*100000)%NEWMAXTILES; | ||
| 8761 | 8281 | break; | |
| 8762 | } | ||
| 8763 | 10360623 | } | |
| 8764 | |||
| 8765 | 3868 | void enemy::tiledir_big(int32_t ndir, bool fourdir) | |
| 8766 | { | ||
| 8767 |
1/2✓ Branch 0 taken 3868 times.
✗ Branch 1 not taken.
|
3868 | if ( !do_animation ) return; |
| 8768 | 3868 | flip=0; | |
| 8769 | |||
| 8770 |
7/9✓ Branch 0 taken 297 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 195 times.
✓ Branch 3 taken 179 times.
✓ Branch 4 taken 306 times.
✓ Branch 5 taken 1235 times.
✓ Branch 6 taken 1324 times.
✓ Branch 7 taken 332 times.
✗ Branch 8 not taken.
|
3868 | switch(ndir) |
| 8771 | { | ||
| 8772 | case 8: | ||
| 8773 | case up: | ||
| 8774 | 297 | break; | |
| 8775 | |||
| 8776 | case 12: | ||
| 8777 | case down: | ||
| 8778 | ✗ | tile+=8; | |
| 8779 | ✗ | break; | |
| 8780 | |||
| 8781 | case 14: | ||
| 8782 | case left: | ||
| 8783 | 195 | tile+=40; | |
| 8784 | 195 | break; | |
| 8785 | |||
| 8786 | case 10: | ||
| 8787 | case right: | ||
| 8788 | 179 | tile+=48; | |
| 8789 | 179 | break; | |
| 8790 | |||
| 8791 | case 9: | ||
| 8792 | case r_up: | ||
| 8793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 306 times.
|
306 | if(fourdir) |
| 8794 | ✗ | break; | |
| 8795 | |||
| 8796 | 306 | tile+=88; | |
| 8797 | 306 | break; | |
| 8798 | |||
| 8799 | case 11: | ||
| 8800 | case r_down: | ||
| 8801 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1235 times.
|
1235 | if(fourdir) |
| 8802 | ✗ | tile+=8; | |
| 8803 | else | ||
| 8804 | 1235 | tile+=128; | |
| 8805 | |||
| 8806 | 1235 | break; | |
| 8807 | |||
| 8808 | case 13: | ||
| 8809 | case l_down: | ||
| 8810 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1324 times.
|
1324 | if(fourdir) |
| 8811 | ✗ | tile+=8; | |
| 8812 | else | ||
| 8813 | 1324 | tile+=120; | |
| 8814 | |||
| 8815 | 1324 | break; | |
| 8816 | |||
| 8817 | case 15: | ||
| 8818 | case l_up: | ||
| 8819 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(fourdir) |
| 8820 | ✗ | break; | |
| 8821 | |||
| 8822 | 332 | tile+=80; | |
| 8823 | 332 | break; | |
| 8824 | |||
| 8825 | default: | ||
| 8826 | //dir=(zc_oldrand()*100)%8; | ||
| 8827 | //tiledir_big(dir); | ||
| 8828 | // flip=zc_oldrand()&3; | ||
| 8829 | // tile=(zc_oldrand()*100000)%NEWMAXTILES; | ||
| 8830 | ✗ | break; | |
| 8831 | } | ||
| 8832 | 3868 | } | |
| 8833 | |||
| 8834 | 20817598 | void enemy::update_enemy_frame() | |
| 8835 | { | ||
| 8836 |
3/4✓ Branch 0 taken 20817456 times.
✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20817456 times.
|
20817598 | if(fallclk||drownclk) return; |
| 8837 |
1/2✓ Branch 0 taken 20817456 times.
✗ Branch 1 not taken.
|
20817456 | if (!do_animation) |
| 8838 | ✗ | return; | |
| 8839 | |||
| 8840 |
3/4✓ Branch 0 taken 188014 times.
✓ Branch 1 taken 20629442 times.
✓ Branch 2 taken 188014 times.
✗ Branch 3 not taken.
|
20817456 | if (get_bit(quest_rules,qr_OLD_TILE_INITIALIZATION) || tile == 0) tile = o_tile; //tile was initialized here before. It needs to be initialized here as well. |
| 8841 | |||
| 8842 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
20817456 | if(get_bit(quest_rules,qr_ANONE_NOANIM) |
| 8843 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 20817456 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
20817456 | && anim == aNONE && family != eeGUY) |
| 8844 | ✗ | return; | |
| 8845 |
2/2✓ Branch 0 taken 20477700 times.
✓ Branch 1 taken 339756 times.
|
20817456 | int32_t newfrate = zc_max(frate,4); |
| 8846 | 20817456 | int32_t f4=abs(clk/(newfrate/4)); // casts clk to [0,1,2,3] | |
| 8847 | 20817456 | int32_t f2=abs(clk/(newfrate/2)); // casts clk to [0,1] | |
| 8848 |
2/2✓ Branch 0 taken 13522850 times.
✓ Branch 1 taken 7294606 times.
|
20817456 | int32_t fx = get_bit(quest_rules, qr_NEWENEMYTILES) ? f4 : f2; |
| 8849 | 20817456 | tile = o_tile; | |
| 8850 | 20817456 | int32_t basetile = o_tile; | |
| 8851 | 20817456 | int32_t tilerows = 1; // How many rows of tiles? The Extend code needs to know. | |
| 8852 | 20817456 | bool ignore_extend = false; | |
| 8853 |
34/40✓ Branch 0 taken 164903 times.
✓ Branch 1 taken 5459 times.
✓ Branch 2 taken 35552 times.
✓ Branch 3 taken 1313148 times.
✓ Branch 4 taken 216057 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 89141 times.
✓ Branch 7 taken 207174 times.
✓ Branch 8 taken 125758 times.
✓ Branch 9 taken 3868 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2384827 times.
✓ Branch 12 taken 41139 times.
✓ Branch 13 taken 48420 times.
✓ Branch 14 taken 818 times.
✓ Branch 15 taken 353574 times.
✓ Branch 16 taken 595734 times.
✓ Branch 17 taken 163042 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 98223 times.
✓ Branch 20 taken 157529 times.
✓ Branch 21 taken 401570 times.
✓ Branch 22 taken 1046827 times.
✓ Branch 23 taken 805337 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 133804 times.
✓ Branch 26 taken 1947001 times.
✓ Branch 27 taken 3438929 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 399313 times.
✓ Branch 30 taken 912736 times.
✓ Branch 31 taken 614651 times.
✓ Branch 32 taken 161932 times.
✓ Branch 33 taken 1192460 times.
✓ Branch 34 taken 74670 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 3146848 times.
✓ Branch 37 taken 281552 times.
✓ Branch 38 taken 219227 times.
✓ Branch 39 taken 36233 times.
|
20817456 | switch(anim) |
| 8854 | { | ||
| 8855 | |||
| 8856 | case aDONGO: | ||
| 8857 | { | ||
| 8858 | 41139 | int32_t fr = stunclk>0 ? 16 : 8; | |
| 8859 | |||
| 8860 |
6/6✓ Branch 0 taken 39717 times.
✓ Branch 1 taken 1422 times.
✓ Branch 2 taken 4800 times.
✓ Branch 3 taken 34917 times.
✓ Branch 4 taken 1600 times.
✓ Branch 5 taken 3200 times.
|
41139 | if(!dying && clk2>0 && clk2<=64) |
| 8861 | { | ||
| 8862 | // bloated | ||
| 8863 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 832 times.
✓ Branch 2 taken 448 times.
✓ Branch 3 taken 1152 times.
✓ Branch 4 taken 768 times.
|
3200 | switch(dir) |
| 8864 | { | ||
| 8865 | case up: | ||
| 8866 | 832 | tile+=9; | |
| 8867 | 832 | flip=0; | |
| 8868 | 832 | xofs=0; | |
| 8869 | 832 | dummy_int[1]=0; //no additional tiles | |
| 8870 | 832 | break; | |
| 8871 | |||
| 8872 | case down: | ||
| 8873 | 448 | tile+=7; | |
| 8874 | 448 | flip=0; | |
| 8875 | 448 | xofs=0; | |
| 8876 | 448 | dummy_int[1]=0; //no additional tiles | |
| 8877 | 448 | break; | |
| 8878 | |||
| 8879 | case left: | ||
| 8880 | 1152 | flip=1; | |
| 8881 | 1152 | tile+=4; | |
| 8882 | 1152 | xofs=16; | |
| 8883 | 1152 | dummy_int[1]=1; //second tile is next tile | |
| 8884 | 1152 | break; | |
| 8885 | |||
| 8886 | case right: | ||
| 8887 | 768 | flip=0; | |
| 8888 | 768 | tile+=5; | |
| 8889 | 768 | xofs=16; | |
| 8890 | 768 | dummy_int[1]=-1; //second tile is previous tile | |
| 8891 | 768 | break; | |
| 8892 | } | ||
| 8893 | 3200 | } | |
| 8894 |
4/4✓ Branch 0 taken 1422 times.
✓ Branch 1 taken 36517 times.
✓ Branch 2 taken 639 times.
✓ Branch 3 taken 783 times.
|
37939 | else if(!dying || clk2>19) |
| 8895 | { | ||
| 8896 | // normal | ||
| 8897 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 7974 times.
✓ Branch 2 taken 8400 times.
✓ Branch 3 taken 12214 times.
✓ Branch 4 taken 8568 times.
|
37156 | switch(dir) |
| 8898 | { | ||
| 8899 | case up: | ||
| 8900 | 7974 | tile+=8; | |
| 8901 | 7974 | flip=(clk&fr)?1:0; | |
| 8902 | 7974 | xofs=0; | |
| 8903 | 7974 | dummy_int[1]=0; //no additional tiles | |
| 8904 | 7974 | break; | |
| 8905 | |||
| 8906 | case down: | ||
| 8907 | 8400 | tile+=6; | |
| 8908 | 8400 | flip=(clk&fr)?1:0; | |
| 8909 | 8400 | xofs=0; | |
| 8910 | 8400 | dummy_int[1]=0; //no additional tiles | |
| 8911 | 8400 | break; | |
| 8912 | |||
| 8913 | case left: | ||
| 8914 | 12214 | flip=1; | |
| 8915 | 12214 | tile+=(clk&fr)?2:0; | |
| 8916 | 12214 | xofs=16; | |
| 8917 | 12214 | dummy_int[1]=1; //second tile is next tile | |
| 8918 | 12214 | break; | |
| 8919 | |||
| 8920 | case right: | ||
| 8921 | 8568 | flip=0; | |
| 8922 | 8568 | tile+=(clk&fr)?3:1; | |
| 8923 | 8568 | xofs=16; | |
| 8924 | 8568 | dummy_int[1]=-1; //second tile is next tile | |
| 8925 | 8568 | break; | |
| 8926 | } | ||
| 8927 | 37156 | } | |
| 8928 | } | ||
| 8929 | 41139 | break; | |
| 8930 | |||
| 8931 | case aNEWDONGO: | ||
| 8932 | { | ||
| 8933 | 48420 | int32_t fr4=0; | |
| 8934 | |||
| 8935 |
6/6✓ Branch 0 taken 46728 times.
✓ Branch 1 taken 1692 times.
✓ Branch 2 taken 3648 times.
✓ Branch 3 taken 43080 times.
✓ Branch 4 taken 1216 times.
✓ Branch 5 taken 2432 times.
|
48420 | if(!dying && clk2>0 && clk2<=64) |
| 8936 | { | ||
| 8937 | // bloated | ||
| 8938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2432 times.
|
2432 | if(clk2>=0) |
| 8939 | { | ||
| 8940 | 2432 | fr4=3; | |
| 8941 | 2432 | } | |
| 8942 | |||
| 8943 |
2/2✓ Branch 0 taken 570 times.
✓ Branch 1 taken 1862 times.
|
2432 | if(clk2>=16) |
| 8944 | { | ||
| 8945 | 1862 | fr4=2; | |
| 8946 | 1862 | } | |
| 8947 | |||
| 8948 |
2/2✓ Branch 0 taken 1178 times.
✓ Branch 1 taken 1254 times.
|
2432 | if(clk2>=32) |
| 8949 | { | ||
| 8950 | 1254 | fr4=1; | |
| 8951 | 1254 | } | |
| 8952 | |||
| 8953 |
2/2✓ Branch 0 taken 1786 times.
✓ Branch 1 taken 646 times.
|
2432 | if(clk2>=48) |
| 8954 | { | ||
| 8955 | 646 | fr4=0; | |
| 8956 | 646 | } | |
| 8957 | |||
| 8958 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 256 times.
✓ Branch 2 taken 576 times.
✓ Branch 3 taken 576 times.
✓ Branch 4 taken 1024 times.
|
2432 | switch(dir) |
| 8959 | { | ||
| 8960 | case up: | ||
| 8961 | 256 | xofs=0; | |
| 8962 | 256 | tile+=8+fr4; | |
| 8963 | 256 | dummy_int[1]=0; //no additional tiles | |
| 8964 | 256 | break; | |
| 8965 | |||
| 8966 | case down: | ||
| 8967 | 576 | xofs=0; | |
| 8968 | 576 | tile+=12+fr4; | |
| 8969 | 576 | dummy_int[1]=0; //no additional tiles | |
| 8970 | 576 | break; | |
| 8971 | |||
| 8972 | case left: | ||
| 8973 | 576 | tile+=29+(2*fr4); | |
| 8974 | 576 | xofs=16; | |
| 8975 | 576 | dummy_int[1]=-1; //second tile is previous tile | |
| 8976 | 576 | break; | |
| 8977 | |||
| 8978 | case right: | ||
| 8979 | 1024 | tile+=49+(2*fr4); | |
| 8980 | 1024 | xofs=16; | |
| 8981 | 1024 | dummy_int[1]=-1; //second tile is previous tile | |
| 8982 | 1024 | break; | |
| 8983 | } | ||
| 8984 | 2432 | } | |
| 8985 |
4/4✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 44296 times.
✓ Branch 2 taken 923 times.
✓ Branch 3 taken 769 times.
|
45988 | else if(!dying || clk2>19) |
| 8986 | { | ||
| 8987 | // normal | ||
| 8988 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8569 times.
✓ Branch 2 taken 8925 times.
✓ Branch 3 taken 13235 times.
✓ Branch 4 taken 14490 times.
|
45219 | switch(dir) |
| 8989 | { | ||
| 8990 | case up: | ||
| 8991 | 8569 | xofs=0; | |
| 8992 | 8569 | tile+=((clk&12)>>2); | |
| 8993 | 8569 | dummy_int[1]=0; //no additional tiles | |
| 8994 | 8569 | break; | |
| 8995 | |||
| 8996 | case down: | ||
| 8997 | 8925 | xofs=0; | |
| 8998 | 8925 | tile+=4+((clk&12)>>2); | |
| 8999 | 8925 | dummy_int[1]=0; //no additional tiles | |
| 9000 | 8925 | break; | |
| 9001 | |||
| 9002 | case left: | ||
| 9003 | 13235 | tile+=21+((clk&12)>>1); | |
| 9004 | 13235 | xofs=16; | |
| 9005 | 13235 | dummy_int[1]=-1; //second tile is previous tile | |
| 9006 | 13235 | break; | |
| 9007 | |||
| 9008 | case right: | ||
| 9009 | 14490 | flip=0; | |
| 9010 | 14490 | tile+=41+((clk&12)>>1); | |
| 9011 | 14490 | xofs=16; | |
| 9012 | 14490 | dummy_int[1]=-1; //second tile is previous tile | |
| 9013 | 14490 | break; | |
| 9014 | } | ||
| 9015 | 45219 | } | |
| 9016 | } | ||
| 9017 | 48420 | break; | |
| 9018 | |||
| 9019 | case aDONGOBS: | ||
| 9020 | { | ||
| 9021 | 818 | int32_t fr4=0; | |
| 9022 | |||
| 9023 |
6/6✓ Branch 0 taken 782 times.
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 192 times.
✓ Branch 3 taken 590 times.
✓ Branch 4 taken 64 times.
✓ Branch 5 taken 128 times.
|
818 | if(!dying && clk2>0 && clk2<=64) |
| 9024 | { | ||
| 9025 | // bloated | ||
| 9026 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | if(clk2>=0) |
| 9027 | { | ||
| 9028 | 128 | fr4=3; | |
| 9029 | 128 | } | |
| 9030 | |||
| 9031 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 98 times.
|
128 | if(clk2>=16) |
| 9032 | { | ||
| 9033 | 98 | fr4=2; | |
| 9034 | 98 | } | |
| 9035 | |||
| 9036 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 66 times.
|
128 | if(clk2>=32) |
| 9037 | { | ||
| 9038 | 66 | fr4=1; | |
| 9039 | 66 | } | |
| 9040 | |||
| 9041 |
2/2✓ Branch 0 taken 94 times.
✓ Branch 1 taken 34 times.
|
128 | if(clk2>=48) |
| 9042 | { | ||
| 9043 | 34 | fr4=0; | |
| 9044 | 34 | } | |
| 9045 | |||
| 9046 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 128 times.
✗ Branch 4 not taken.
|
128 | switch(dir) |
| 9047 | { | ||
| 9048 | case up: | ||
| 9049 | ✗ | tile+=28+fr4; | |
| 9050 | ✗ | yofs+=8; | |
| 9051 | ✗ | dummy_int[1]=-20; //second tile change | |
| 9052 | ✗ | dummy_int[2]=0; //new xofs change | |
| 9053 | ✗ | dummy_int[3]=-16; //new xofs change | |
| 9054 | ✗ | break; | |
| 9055 | |||
| 9056 | case down: | ||
| 9057 | ✗ | tile+=12+fr4; | |
| 9058 | ✗ | yofs-=8; | |
| 9059 | ✗ | dummy_int[1]=20; //second tile change | |
| 9060 | ✗ | dummy_int[2]=0; //new xofs change | |
| 9061 | ✗ | dummy_int[3]=16; //new xofs change | |
| 9062 | ✗ | break; | |
| 9063 | |||
| 9064 | case left: | ||
| 9065 | 128 | tile+=49+(2*fr4); | |
| 9066 | 128 | xofs+=8; | |
| 9067 | 128 | dummy_int[1]=-1; //second tile change | |
| 9068 | 128 | dummy_int[2]=-16; //new xofs change | |
| 9069 | 128 | dummy_int[3]=0; //new xofs change | |
| 9070 | 128 | break; | |
| 9071 | |||
| 9072 | case right: | ||
| 9073 | ✗ | tile+=69+(2*fr4); | |
| 9074 | ✗ | xofs+=8; | |
| 9075 | ✗ | dummy_int[1]=-1; //second tile change | |
| 9076 | ✗ | dummy_int[2]=-16; //new xofs change | |
| 9077 | ✗ | dummy_int[3]=0; //new xofs change | |
| 9078 | ✗ | break; | |
| 9079 | } | ||
| 9080 | 128 | } | |
| 9081 |
3/4✓ Branch 0 taken 36 times.
✓ Branch 1 taken 654 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36 times.
|
690 | else if(!dying || clk2>19) |
| 9082 | { | ||
| 9083 | // normal | ||
| 9084 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 129 times.
✓ Branch 3 taken 332 times.
✓ Branch 4 taken 97 times.
|
654 | switch(dir) |
| 9085 | { | ||
| 9086 | case up: | ||
| 9087 | 96 | tile+=20+((clk&24)>>3); | |
| 9088 | 96 | yofs+=8; | |
| 9089 | 96 | dummy_int[1]=-20; //second tile change | |
| 9090 | 96 | dummy_int[2]=0; //new xofs change | |
| 9091 | 96 | dummy_int[3]=-16; //new xofs change | |
| 9092 | 96 | break; | |
| 9093 | |||
| 9094 | case down: | ||
| 9095 | 129 | tile+=4+((clk&24)>>3); | |
| 9096 | 129 | yofs-=8; | |
| 9097 | 129 | dummy_int[1]=20; //second tile change | |
| 9098 | 129 | dummy_int[2]=0; //new xofs change | |
| 9099 | 129 | dummy_int[3]=16; //new xofs change | |
| 9100 | 129 | break; | |
| 9101 | |||
| 9102 | case left: | ||
| 9103 | 332 | xofs=-8; | |
| 9104 | 332 | tile+=40+((clk&24)>>2); | |
| 9105 | 332 | dummy_int[1]=1; //second tile change | |
| 9106 | 332 | dummy_int[2]=16; //new xofs change | |
| 9107 | 332 | dummy_int[3]=0; //new xofs change | |
| 9108 | 332 | break; | |
| 9109 | |||
| 9110 | case right: | ||
| 9111 | 97 | tile+=60+((clk&24)>>2); | |
| 9112 | 97 | xofs=-8; | |
| 9113 | 97 | dummy_int[1]=1; //second tile change | |
| 9114 | 97 | dummy_int[2]=16; //new xofs change | |
| 9115 | 97 | dummy_int[3]=0; //new xofs change | |
| 9116 | 97 | break; | |
| 9117 | } | ||
| 9118 | 654 | } | |
| 9119 | } | ||
| 9120 | 818 | break; | |
| 9121 | |||
| 9122 | case aWIZZ: | ||
| 9123 | { | ||
| 9124 | // if(d->misc1) | ||
| 9125 |
2/2✓ Branch 0 taken 139048 times.
✓ Branch 1 taken 214526 times.
|
353574 | if(dmisc1) |
| 9126 | { | ||
| 9127 |
2/2✓ Branch 0 taken 69275 times.
✓ Branch 1 taken 69773 times.
|
139048 | if(clk&8) |
| 9128 | { | ||
| 9129 | 69773 | ++tile; | |
| 9130 | 69773 | } | |
| 9131 | 139048 | } | |
| 9132 | else | ||
| 9133 | { | ||
| 9134 |
2/2✓ Branch 0 taken 107350 times.
✓ Branch 1 taken 107176 times.
|
214526 | if(frame&4) |
| 9135 | { | ||
| 9136 | 107176 | ++tile; | |
| 9137 | 107176 | } | |
| 9138 | } | ||
| 9139 | |||
| 9140 |
4/4✓ Branch 0 taken 55328 times.
✓ Branch 1 taken 124116 times.
✓ Branch 2 taken 114795 times.
✓ Branch 3 taken 59335 times.
|
353574 | switch(dir) |
| 9141 | { | ||
| 9142 | case 9: | ||
| 9143 | case 15: | ||
| 9144 | case up: | ||
| 9145 | 55328 | tile+=2; | |
| 9146 | 55328 | break; | |
| 9147 | |||
| 9148 | case down: | ||
| 9149 | 59335 | break; | |
| 9150 | |||
| 9151 | case 13: | ||
| 9152 | case left: | ||
| 9153 | 124116 | flip=1; | |
| 9154 | 124116 | break; | |
| 9155 | |||
| 9156 | default: | ||
| 9157 | 114795 | flip=0; | |
| 9158 | 114795 | break; | |
| 9159 | } | ||
| 9160 | } | ||
| 9161 | 353574 | break; | |
| 9162 | |||
| 9163 | case aNEWWIZZ: | ||
| 9164 | { | ||
| 9165 | 595734 | tiledir(dir,true); | |
| 9166 | |||
| 9167 | // if(d->misc1) //walking wizzrobe | ||
| 9168 |
2/2✓ Branch 0 taken 316790 times.
✓ Branch 1 taken 278944 times.
|
595734 | if(dmisc1) //walking wizzrobe |
| 9169 | { | ||
| 9170 |
2/2✓ Branch 0 taken 159200 times.
✓ Branch 1 taken 157590 times.
|
316790 | if(clk&8) |
| 9171 | { | ||
| 9172 | 157590 | tile+=2; | |
| 9173 | 157590 | } | |
| 9174 | |||
| 9175 |
2/2✓ Branch 0 taken 158616 times.
✓ Branch 1 taken 158174 times.
|
316790 | if(clk&4) |
| 9176 | { | ||
| 9177 | 158174 | tile+=1; | |
| 9178 | 158174 | } | |
| 9179 | |||
| 9180 |
2/4✓ Branch 0 taken 316790 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 316790 times.
|
316790 | if(!(dummy_bool[1]||dummy_bool[2])) //should never be charging or firing for these wizzrobes |
| 9181 | { | ||
| 9182 |
2/2✓ Branch 0 taken 283104 times.
✓ Branch 1 taken 33686 times.
|
316790 | if(dummy_int[1]>0) |
| 9183 | { | ||
| 9184 | 33686 | tile+=40; | |
| 9185 | 33686 | } | |
| 9186 | 316790 | } | |
| 9187 | 316790 | } | |
| 9188 | else | ||
| 9189 | { | ||
| 9190 |
4/4✓ Branch 0 taken 255725 times.
✓ Branch 1 taken 23219 times.
✓ Branch 2 taken 59829 times.
✓ Branch 3 taken 195896 times.
|
278944 | if(dummy_bool[1]||dummy_bool[2]) |
| 9191 | { | ||
| 9192 | 83048 | tile+=20; | |
| 9193 | |||
| 9194 |
2/2✓ Branch 0 taken 23219 times.
✓ Branch 1 taken 59829 times.
|
83048 | if(dummy_bool[2]) |
| 9195 | { | ||
| 9196 | 59829 | tile+=20; | |
| 9197 | 59829 | } | |
| 9198 | 83048 | } | |
| 9199 | |||
| 9200 | 278944 | tile+=((frame>>1)&3); | |
| 9201 | } | ||
| 9202 | } | ||
| 9203 | 595734 | break; | |
| 9204 | |||
| 9205 | case a3FRM: | ||
| 9206 | { | ||
| 9207 |
2/2✓ Branch 0 taken 38762 times.
✓ Branch 1 taken 124280 times.
|
163042 | basetile = n_frame_n_dir(3, 0, (f4==3) ? 1 : f4); |
| 9208 | } | ||
| 9209 | 163042 | break; | |
| 9210 | |||
| 9211 | case a3FRM4DIR: | ||
| 9212 | { | ||
| 9213 | ✗ | basetile = n_frame_n_dir(3, 4, (f4==3) ? 1 : f4); | |
| 9214 | } | ||
| 9215 | ✗ | break; | |
| 9216 | |||
| 9217 | case aVIRE: | ||
| 9218 | { | ||
| 9219 |
2/2✓ Branch 0 taken 76001 times.
✓ Branch 1 taken 22222 times.
|
98223 | if(dir==up) |
| 9220 | { | ||
| 9221 | 22222 | tile+=2; | |
| 9222 | 22222 | } | |
| 9223 | |||
| 9224 | 98223 | tile+=fx; | |
| 9225 | } | ||
| 9226 | 98223 | break; | |
| 9227 | |||
| 9228 | case aROPE: | ||
| 9229 | { | ||
| 9230 | 164903 | tile+=(1-fx); | |
| 9231 | 164903 | flip = dir==left ? 1:0; | |
| 9232 | } | ||
| 9233 | 164903 | break; | |
| 9234 | |||
| 9235 | case aZORA: | ||
| 9236 | { | ||
| 9237 | int32_t dl; | ||
| 9238 | |||
| 9239 |
2/2✓ Branch 0 taken 33018 times.
✓ Branch 1 taken 124511 times.
|
157529 | if(clk<36) |
| 9240 | { | ||
| 9241 | 33018 | dl=clk+5; | |
| 9242 | 33018 | goto waves2; | |
| 9243 | } | ||
| 9244 | |||
| 9245 |
2/2✓ Branch 0 taken 58613 times.
✓ Branch 1 taken 65898 times.
|
124511 | if(clk<36+66) |
| 9246 |
2/2✓ Branch 0 taken 33479 times.
✓ Branch 1 taken 25134 times.
|
58613 | tile=(dir==up)?o_tile+1:o_tile; |
| 9247 | else | ||
| 9248 | { | ||
| 9249 | 65898 | dl=clk-36-66; | |
| 9250 | waves2: | ||
| 9251 | 98916 | tile=((dl/11)&1)+s_tile; | |
| 9252 | 98916 | basetile = s_tile; | |
| 9253 | } | ||
| 9254 | } | ||
| 9255 | 157529 | break; | |
| 9256 | |||
| 9257 | case aNEWZORA: | ||
| 9258 | { | ||
| 9259 | 401570 | f4=(clk/16)%4; | |
| 9260 | |||
| 9261 | 401570 | tiledir(dir,true); | |
| 9262 | int32_t dl; | ||
| 9263 | |||
| 9264 |
4/4✓ Branch 0 taken 289179 times.
✓ Branch 1 taken 112391 times.
✓ Branch 2 taken 151547 times.
✓ Branch 3 taken 137632 times.
|
401570 | if((clk>35)&&(clk<36+67)) //surfaced |
| 9265 | { | ||
| 9266 |
4/4✓ Branch 0 taken 117577 times.
✓ Branch 1 taken 20055 times.
✓ Branch 2 taken 16796 times.
✓ Branch 3 taken 100781 times.
|
137632 | if((clk>=(35+10))&&(clk<(38+56))) //mouth open |
| 9267 | { | ||
| 9268 | 100781 | tile+=80; | |
| 9269 | 100781 | } //mouth closed | |
| 9270 | else | ||
| 9271 | { | ||
| 9272 | 36851 | tile+=40; | |
| 9273 | } | ||
| 9274 | |||
| 9275 | 137632 | tile+=f4; | |
| 9276 | 137632 | } | |
| 9277 | else | ||
| 9278 | { | ||
| 9279 |
2/2✓ Branch 0 taken 112391 times.
✓ Branch 1 taken 151547 times.
|
263938 | if(clk<36) |
| 9280 | { | ||
| 9281 | 112391 | dl=clk+5; | |
| 9282 | 112391 | } | |
| 9283 | else | ||
| 9284 | { | ||
| 9285 | 151547 | dl=clk-36-66; | |
| 9286 | } | ||
| 9287 | |||
| 9288 | 263938 | tile+=((dl/5)&3); | |
| 9289 | } | ||
| 9290 | } | ||
| 9291 | 401570 | break; | |
| 9292 | |||
| 9293 | case a4FRM4EYE: | ||
| 9294 | case a2FRM4EYE: | ||
| 9295 | case a4FRM8EYE: | ||
| 9296 | case a4FRM8EYEB: //big version | ||
| 9297 | case a4FRM4EYEB: | ||
| 9298 | { | ||
| 9299 | 125758 | tilerows = 2; | |
| 9300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 125758 times.
|
125758 | int fakex = x + 8*(zc_max(1,txsz)-1); |
| 9301 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 125758 times.
|
125758 | int fakey = y + 8*(zc_max(1,tysz)-1); |
| 9302 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 9303 | 125758 | double ddir=atan2_MSVC2022_FIX(double(fakey-(Hero.y)),double(Hero.x-fakex)); | |
| 9304 | 125758 | int32_t lookat=zc_oldrand()&15; | |
| 9305 | |||
| 9306 |
4/4✓ Branch 0 taken 40954 times.
✓ Branch 1 taken 84804 times.
✓ Branch 2 taken 20184 times.
✓ Branch 3 taken 20770 times.
|
125758 | if((ddir<=(((-5)*PI)/8))&&(ddir>(((-7)*PI)/8))) |
| 9307 | { | ||
| 9308 | 20770 | lookat=l_down; | |
| 9309 | 20770 | } | |
| 9310 |
4/4✓ Branch 0 taken 41154 times.
✓ Branch 1 taken 63834 times.
✓ Branch 2 taken 20184 times.
✓ Branch 3 taken 20970 times.
|
104988 | else if((ddir<=(((-3)*PI)/8))&&(ddir>(((-5)*PI)/8))) |
| 9311 | { | ||
| 9312 | 20970 | lookat=down; | |
| 9313 | 20970 | } | |
| 9314 |
4/4✓ Branch 0 taken 33302 times.
✓ Branch 1 taken 50716 times.
✓ Branch 2 taken 20184 times.
✓ Branch 3 taken 13118 times.
|
84018 | else if((ddir<=(((-1)*PI)/8))&&(ddir>(((-3)*PI)/8))) |
| 9315 | { | ||
| 9316 | 13118 | lookat=r_down; | |
| 9317 | 13118 | } | |
| 9318 |
4/4✓ Branch 0 taken 31638 times.
✓ Branch 1 taken 39262 times.
✓ Branch 2 taken 20184 times.
✓ Branch 3 taken 11454 times.
|
70900 | else if((ddir<=(((1)*PI)/8))&&(ddir>(((-1)*PI)/8))) |
| 9319 | { | ||
| 9320 | 11454 | lookat=right; | |
| 9321 | 11454 | } | |
| 9322 |
4/4✓ Branch 0 taken 24538 times.
✓ Branch 1 taken 34908 times.
✓ Branch 2 taken 20184 times.
✓ Branch 3 taken 4354 times.
|
59446 | else if((ddir<=(((3)*PI)/8))&&(ddir>(((1)*PI)/8))) |
| 9323 | { | ||
| 9324 | 4354 | lookat=r_up; | |
| 9325 | 4354 | } | |
| 9326 |
4/4✓ Branch 0 taken 25602 times.
✓ Branch 1 taken 29490 times.
✓ Branch 2 taken 20184 times.
✓ Branch 3 taken 5418 times.
|
55092 | else if((ddir<=(((5)*PI)/8))&&(ddir>(((3)*PI)/8))) |
| 9327 | { | ||
| 9328 | 5418 | lookat=up; | |
| 9329 | 5418 | } | |
| 9330 |
4/4✓ Branch 0 taken 29766 times.
✓ Branch 1 taken 19908 times.
✓ Branch 2 taken 20184 times.
✓ Branch 3 taken 9582 times.
|
49674 | else if((ddir<=(((7)*PI)/8))&&(ddir>(((5)*PI)/8))) |
| 9331 | { | ||
| 9332 | 9582 | lookat=l_up; | |
| 9333 | 9582 | } | |
| 9334 | else | ||
| 9335 | { | ||
| 9336 | 40092 | lookat=left; | |
| 9337 | } | ||
| 9338 | |||
| 9339 | 125758 | int32_t dir2 = dir; | |
| 9340 | 125758 | dir = lookat; | |
| 9341 |
3/6✓ Branch 0 taken 125758 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 125758 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 125758 times.
|
125758 | if (anim != a4FRM8EYEB && anim != a4FRM4EYEB) basetile = n_frame_n_dir(anim==a2FRM4EYE ? 2:4, anim==a4FRM8EYE ? 8 : 4, anim==a2FRM4EYE ? (f2&1):f4); |
| 9342 | else | ||
| 9343 | { | ||
| 9344 | ✗ | tiledir_big(dir,(anim == a4FRM4EYEB)); | |
| 9345 | ✗ | tile+=2*f4; | |
| 9346 | ✗ | ignore_extend = true; | |
| 9347 | } | ||
| 9348 | 125758 | dir = dir2; | |
| 9349 | } | ||
| 9350 | 125758 | break; | |
| 9351 | |||
| 9352 | case aFLIP: | ||
| 9353 | { | ||
| 9354 | 1046827 | flip = f2&1; | |
| 9355 | } | ||
| 9356 | 1046827 | break; | |
| 9357 | |||
| 9358 | case a2FRM: | ||
| 9359 | { | ||
| 9360 | 805337 | tile += (1-f2); | |
| 9361 | } | ||
| 9362 | 805337 | break; | |
| 9363 | |||
| 9364 | case a2FRMB: | ||
| 9365 | { | ||
| 9366 | ✗ | tile+= 2*(1-f2); | |
| 9367 | ✗ | ignore_extend = true; | |
| 9368 | } | ||
| 9369 | ✗ | break; | |
| 9370 | |||
| 9371 | case a2FRM4DIR: | ||
| 9372 | { | ||
| 9373 | 133804 | basetile = n_frame_n_dir(2, 4, f2&1); | |
| 9374 | } | ||
| 9375 | 133804 | break; | |
| 9376 | |||
| 9377 | case a4FRM4DIRF: | ||
| 9378 | { | ||
| 9379 | 1947001 | basetile = n_frame_n_dir(4,4,f4); | |
| 9380 | |||
| 9381 |
2/2✓ Branch 0 taken 1242623 times.
✓ Branch 1 taken 704378 times.
|
1947001 | if(clk2>0) //stopped to fire |
| 9382 | { | ||
| 9383 | 704378 | tile+=20; | |
| 9384 | |||
| 9385 |
2/2✓ Branch 0 taken 337123 times.
✓ Branch 1 taken 367255 times.
|
704378 | if(clk2<17) //firing |
| 9386 | { | ||
| 9387 | 367255 | tile+=20; | |
| 9388 | 367255 | } | |
| 9389 | 704378 | } | |
| 9390 | } | ||
| 9391 | 1947001 | break; | |
| 9392 | |||
| 9393 | case a4FRM4DIR: | ||
| 9394 | { | ||
| 9395 | 3438929 | basetile = n_frame_n_dir(4,4,f4); | |
| 9396 | } | ||
| 9397 | 3438929 | break; | |
| 9398 | |||
| 9399 | case a4FRM8DIRF: | ||
| 9400 | { | ||
| 9401 | ✗ | tilerows = 2; | |
| 9402 | ✗ | basetile = n_frame_n_dir(4,8,f4); | |
| 9403 | |||
| 9404 | ✗ | if(clk2>0) //stopped to fire | |
| 9405 | { | ||
| 9406 | ✗ | tile+=40; | |
| 9407 | |||
| 9408 | ✗ | if(clk2<17) //firing | |
| 9409 | { | ||
| 9410 | ✗ | tile+=40; | |
| 9411 | ✗ | } | |
| 9412 | ✗ | } | |
| 9413 | } | ||
| 9414 | ✗ | break; | |
| 9415 | |||
| 9416 | case a4FRM8DIRB: | ||
| 9417 | case a4FRM8DIRFB: | ||
| 9418 | { | ||
| 9419 | 3868 | tilerows = 2; | |
| 9420 | 3868 | tiledir_big(dir,false); | |
| 9421 | 3868 | tile+=2*f4; | |
| 9422 |
3/4✓ Branch 0 taken 3866 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 3866 times.
✗ Branch 3 not taken.
|
3868 | if(clk2>0 && anim == a4FRM8DIRFB) //stopped to fire |
| 9423 | { | ||
| 9424 | ✗ | tile+=80; | |
| 9425 | |||
| 9426 | ✗ | if(clk2<17) //firing | |
| 9427 | { | ||
| 9428 | ✗ | tile+=80; | |
| 9429 | ✗ | } | |
| 9430 | ✗ | } | |
| 9431 | 3868 | ignore_extend = true; | |
| 9432 | } | ||
| 9433 | 3868 | break; | |
| 9434 | |||
| 9435 | case a4FRM4DIRB: | ||
| 9436 | case a4FRM4DIRFB: | ||
| 9437 | { | ||
| 9438 | ✗ | tilerows = 2; | |
| 9439 | ✗ | tiledir_big(dir,true); | |
| 9440 | ✗ | tile+=2*f4; | |
| 9441 | ✗ | if(clk2>0 && anim == a4FRM4DIRFB) //stopped to fire | |
| 9442 | { | ||
| 9443 | ✗ | tile+=40; | |
| 9444 | |||
| 9445 | ✗ | if(clk2<17) //firing | |
| 9446 | { | ||
| 9447 | ✗ | tile+=40; | |
| 9448 | ✗ | } | |
| 9449 | ✗ | } | |
| 9450 | ✗ | ignore_extend = true; | |
| 9451 | } | ||
| 9452 | ✗ | break; | |
| 9453 | |||
| 9454 | case aOCTO: | ||
| 9455 | { | ||
| 9456 |
5/5✓ Branch 0 taken 2913 times.
✓ Branch 1 taken 85458 times.
✓ Branch 2 taken 96229 times.
✓ Branch 3 taken 112826 times.
✓ Branch 4 taken 101887 times.
|
399313 | switch(dir) |
| 9457 | { | ||
| 9458 | case up: | ||
| 9459 | 85458 | flip = 2; | |
| 9460 | 85458 | break; | |
| 9461 | |||
| 9462 | case down: | ||
| 9463 | 96229 | flip = 0; | |
| 9464 | 96229 | break; | |
| 9465 | |||
| 9466 | case left: | ||
| 9467 | 112826 | flip = 0; | |
| 9468 | 112826 | tile += 2; | |
| 9469 | 112826 | break; | |
| 9470 | |||
| 9471 | case right: | ||
| 9472 | 101887 | flip = 1; | |
| 9473 | 101887 | tile += 2; | |
| 9474 | 101887 | break; | |
| 9475 | } | ||
| 9476 | |||
| 9477 | 399313 | tile+=f2; | |
| 9478 | } | ||
| 9479 | 399313 | break; | |
| 9480 | |||
| 9481 | case aWALK: | ||
| 9482 | { | ||
| 9483 |
5/5✓ Branch 0 taken 4582 times.
✓ Branch 1 taken 187339 times.
✓ Branch 2 taken 207694 times.
✓ Branch 3 taken 256906 times.
✓ Branch 4 taken 256215 times.
|
912736 | switch(dir) |
| 9484 | { | ||
| 9485 | case up: | ||
| 9486 | 187339 | tile+=3; | |
| 9487 | 187339 | flip = f2; | |
| 9488 | 187339 | break; | |
| 9489 | |||
| 9490 | case down: | ||
| 9491 | 207694 | tile+=2; | |
| 9492 | 207694 | flip = f2; | |
| 9493 | 207694 | break; | |
| 9494 | |||
| 9495 | case left: | ||
| 9496 | 256906 | flip=1; | |
| 9497 | 256906 | tile += f2; | |
| 9498 | 256906 | break; | |
| 9499 | |||
| 9500 | case right: | ||
| 9501 | 256215 | flip=0; | |
| 9502 | 256215 | tile += f2; | |
| 9503 | 256215 | break; | |
| 9504 | } | ||
| 9505 | } | ||
| 9506 | 912736 | break; | |
| 9507 | |||
| 9508 | case aDWALK: | ||
| 9509 | { | ||
| 9510 |
3/4✓ Branch 0 taken 81208 times.
✓ Branch 1 taken 533443 times.
✓ Branch 2 taken 81208 times.
✗ Branch 3 not taken.
|
614651 | if((get_bit(quest_rules,qr_BRKNSHLDTILES)) && (dummy_bool[1]==true)) |
| 9511 | { | ||
| 9512 | ✗ | tile=s_tile; | |
| 9513 | ✗ | basetile = s_tile; | |
| 9514 | ✗ | } | |
| 9515 | |||
| 9516 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 129268 times.
✓ Branch 2 taken 133261 times.
✓ Branch 3 taken 177242 times.
✓ Branch 4 taken 174880 times.
|
614651 | switch(dir) |
| 9517 | { | ||
| 9518 | case up: | ||
| 9519 | 129268 | tile+=2; | |
| 9520 | 129268 | flip=f2; | |
| 9521 | 129268 | break; | |
| 9522 | |||
| 9523 | case down: | ||
| 9524 | 133261 | flip=0; | |
| 9525 | 133261 | tile+=(1-f2); | |
| 9526 | 133261 | break; | |
| 9527 | |||
| 9528 | case left: | ||
| 9529 | 177242 | flip=1; | |
| 9530 | 177242 | tile+=(3+f2); | |
| 9531 | 177242 | break; | |
| 9532 | |||
| 9533 | case right: | ||
| 9534 | 174880 | flip=0; | |
| 9535 | 174880 | tile+=(3+f2); | |
| 9536 | 174880 | break; | |
| 9537 | } | ||
| 9538 | } | ||
| 9539 | 614651 | break; | |
| 9540 | |||
| 9541 | case aTEK: | ||
| 9542 | { | ||
| 9543 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 60556 times.
|
161932 | if(misc==0) |
| 9544 | { | ||
| 9545 | 60556 | tile += f2; | |
| 9546 | 60556 | } | |
| 9547 |
2/2✓ Branch 0 taken 53958 times.
✓ Branch 1 taken 47418 times.
|
101376 | else if(misc!=1) |
| 9548 | { | ||
| 9549 | 47418 | ++tile; | |
| 9550 | 47418 | } | |
| 9551 | } | ||
| 9552 | 161932 | break; | |
| 9553 | |||
| 9554 | case aNEWTEK: | ||
| 9555 | { | ||
| 9556 |
2/2✓ Branch 0 taken 300110 times.
✓ Branch 1 taken 892350 times.
|
1192460 | if(step<0) //up |
| 9557 | { | ||
| 9558 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 147188 times.
✓ Branch 2 taken 152922 times.
|
300110 | switch(clk3) |
| 9559 | { | ||
| 9560 | case left: | ||
| 9561 | 147188 | flip=0; | |
| 9562 | 147188 | tile+=20; | |
| 9563 | 147188 | break; | |
| 9564 | |||
| 9565 | case right: | ||
| 9566 | 152922 | flip=0; | |
| 9567 | 152922 | tile+=24; | |
| 9568 | 152922 | break; | |
| 9569 | } | ||
| 9570 | 300110 | } | |
| 9571 |
2/2✓ Branch 0 taken 38134 times.
✓ Branch 1 taken 854216 times.
|
892350 | else if(step==0) |
| 9572 | { | ||
| 9573 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 28779 times.
✓ Branch 2 taken 9355 times.
|
38134 | switch(clk3) |
| 9574 | { | ||
| 9575 | case left: | ||
| 9576 | 28779 | flip=0; | |
| 9577 | 28779 | tile+=8; | |
| 9578 | 28779 | break; | |
| 9579 | |||
| 9580 | case right: | ||
| 9581 | 9355 | flip=0; | |
| 9582 | 9355 | tile+=12; | |
| 9583 | 9355 | break; | |
| 9584 | } | ||
| 9585 | 38134 | } //down | |
| 9586 | else | ||
| 9587 | { | ||
| 9588 |
3/3✓ Branch 0 taken 55883 times.
✓ Branch 1 taken 403592 times.
✓ Branch 2 taken 394741 times.
|
854216 | switch(clk3) |
| 9589 | { | ||
| 9590 | case left: | ||
| 9591 | 403592 | flip=0; | |
| 9592 | 403592 | tile+=28; | |
| 9593 | 403592 | break; | |
| 9594 | |||
| 9595 | case right: | ||
| 9596 | 394741 | flip=0; | |
| 9597 | 394741 | tile+=32; | |
| 9598 | 394741 | break; | |
| 9599 | } | ||
| 9600 | } | ||
| 9601 | |||
| 9602 |
2/2✓ Branch 0 taken 757747 times.
✓ Branch 1 taken 434713 times.
|
1192460 | if(misc==0) |
| 9603 | { | ||
| 9604 | 434713 | tile+=f4; | |
| 9605 | 434713 | } | |
| 9606 |
2/2✓ Branch 0 taken 367826 times.
✓ Branch 1 taken 389921 times.
|
757747 | else if(misc!=1) |
| 9607 | { | ||
| 9608 | 389921 | tile+=2; | |
| 9609 | 389921 | } | |
| 9610 | } | ||
| 9611 | 1192460 | break; | |
| 9612 | |||
| 9613 | case aARMOS: | ||
| 9614 | { | ||
| 9615 |
2/2✓ Branch 0 taken 2153 times.
✓ Branch 1 taken 3306 times.
|
5459 | if(!fading) |
| 9616 | { | ||
| 9617 | 3306 | tile += fx; | |
| 9618 | |||
| 9619 |
2/2✓ Branch 0 taken 2459 times.
✓ Branch 1 taken 847 times.
|
3306 | if(dir==up) |
| 9620 | 847 | tile += 2; | |
| 9621 | 3306 | } | |
| 9622 | } | ||
| 9623 | 5459 | break; | |
| 9624 | |||
| 9625 | case aARMOS4: | ||
| 9626 | { | ||
| 9627 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 5907 times.
✓ Branch 2 taken 12136 times.
✓ Branch 3 taken 8764 times.
✓ Branch 4 taken 8745 times.
|
35552 | switch(dir) |
| 9628 | { | ||
| 9629 | case up: | ||
| 9630 | 5907 | flip=0; | |
| 9631 | 5907 | break; | |
| 9632 | |||
| 9633 | case down: | ||
| 9634 | 12136 | flip=0; | |
| 9635 | 12136 | tile+=4; | |
| 9636 | 12136 | break; | |
| 9637 | |||
| 9638 | case left: | ||
| 9639 | 8764 | flip=0; | |
| 9640 | 8764 | tile+=8; | |
| 9641 | 8764 | break; | |
| 9642 | |||
| 9643 | case right: | ||
| 9644 | 8745 | flip=0; | |
| 9645 | 8745 | tile+=12; | |
| 9646 | 8745 | break; | |
| 9647 | } | ||
| 9648 | |||
| 9649 |
2/2✓ Branch 0 taken 6441 times.
✓ Branch 1 taken 29111 times.
|
35552 | if(!fading) |
| 9650 | { | ||
| 9651 | 29111 | tile+=f4; | |
| 9652 | 29111 | } | |
| 9653 | } | ||
| 9654 | 35552 | break; | |
| 9655 | |||
| 9656 | case aGHINI: | ||
| 9657 | { | ||
| 9658 |
4/4✓ Branch 0 taken 14931 times.
✓ Branch 1 taken 18961 times.
✓ Branch 2 taken 40404 times.
✓ Branch 3 taken 374 times.
|
74670 | switch(dir) |
| 9659 | { | ||
| 9660 | case 8: | ||
| 9661 | case 9: | ||
| 9662 | case up: | ||
| 9663 | 14931 | ++tile; | |
| 9664 | 14931 | flip=0; | |
| 9665 | 14931 | break; | |
| 9666 | |||
| 9667 | case 15: | ||
| 9668 | 374 | ++tile; | |
| 9669 | 374 | flip=1; | |
| 9670 | 374 | break; | |
| 9671 | |||
| 9672 | case 10: | ||
| 9673 | case 11: | ||
| 9674 | case right: | ||
| 9675 | 18961 | flip=1; | |
| 9676 | 18961 | break; | |
| 9677 | |||
| 9678 | default: | ||
| 9679 | 40404 | flip=0; | |
| 9680 | 40404 | break; | |
| 9681 | } | ||
| 9682 | } | ||
| 9683 | 74670 | break; | |
| 9684 | |||
| 9685 | case a2FRMPOS: | ||
| 9686 | { | ||
| 9687 | 1313148 | tile+=posframe; | |
| 9688 | } | ||
| 9689 | 1313148 | break; | |
| 9690 | |||
| 9691 | case a4FRMPOS4DIR: | ||
| 9692 | { | ||
| 9693 | 216057 | basetile = n_frame_n_dir(4,4,0); | |
| 9694 | // tile+=f2; | ||
| 9695 | 216057 | tile+=posframe; | |
| 9696 | } | ||
| 9697 | 216057 | break; | |
| 9698 | |||
| 9699 | case a4FRMPOS4DIRF: | ||
| 9700 | { | ||
| 9701 | ✗ | basetile = n_frame_n_dir(4,4,0); | |
| 9702 | |||
| 9703 | ✗ | if(clk2>0) //stopped to fire | |
| 9704 | { | ||
| 9705 | ✗ | tile+=20; | |
| 9706 | |||
| 9707 | ✗ | if(clk2<17) //firing | |
| 9708 | { | ||
| 9709 | ✗ | tile+=20; | |
| 9710 | ✗ | } | |
| 9711 | ✗ | } | |
| 9712 | |||
| 9713 | // tile+=f2; | ||
| 9714 | ✗ | tile+=posframe; | |
| 9715 | } | ||
| 9716 | ✗ | break; | |
| 9717 | |||
| 9718 | case a4FRMPOS8DIR: | ||
| 9719 | { | ||
| 9720 | 3146848 | tilerows = 2; | |
| 9721 | 3146848 | int32_t n = tile; | |
| 9722 | 3146848 | basetile = n_frame_n_dir(4,8,0); | |
| 9723 | // tile+=f2; | ||
| 9724 | 3146848 | tile+=posframe; | |
| 9725 | } | ||
| 9726 | 3146848 | break; | |
| 9727 | |||
| 9728 | case a4FRMPOS8DIRF: | ||
| 9729 | { | ||
| 9730 | ✗ | tilerows = 2; | |
| 9731 | ✗ | basetile = n_frame_n_dir(4,8,0); | |
| 9732 | |||
| 9733 | ✗ | if(clk2>0) //stopped to fire | |
| 9734 | { | ||
| 9735 | ✗ | tile+=40; | |
| 9736 | |||
| 9737 | ✗ | if(clk2<17) //firing | |
| 9738 | { | ||
| 9739 | ✗ | tile+=40; | |
| 9740 | ✗ | } | |
| 9741 | ✗ | } | |
| 9742 | |||
| 9743 | ✗ | tile+=posframe; | |
| 9744 | } | ||
| 9745 | ✗ | break; | |
| 9746 | |||
| 9747 | case aNEWLEV: | ||
| 9748 | { | ||
| 9749 | 281552 | tiledir(dir,true); | |
| 9750 | |||
| 9751 |
4/5✓ Branch 0 taken 92775 times.
✓ Branch 1 taken 45501 times.
✓ Branch 2 taken 18315 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 124961 times.
|
281552 | switch(misc) |
| 9752 | { | ||
| 9753 | case -1: | ||
| 9754 | case 0: | ||
| 9755 | 92775 | return; | |
| 9756 | |||
| 9757 | case 1: | ||
| 9758 | |||
| 9759 | // case 5: cs = d->misc2; break; | ||
| 9760 | case 5: | ||
| 9761 | 45501 | cs = dmisc2; | |
| 9762 | 45501 | break; | |
| 9763 | |||
| 9764 | case 2: | ||
| 9765 | case 4: | ||
| 9766 | 18315 | tile += 20; | |
| 9767 | 18315 | break; | |
| 9768 | |||
| 9769 | case 3: | ||
| 9770 | 124961 | tile += 40; | |
| 9771 | 124961 | break; | |
| 9772 | } | ||
| 9773 | |||
| 9774 | 188777 | tile+=f4; | |
| 9775 | } | ||
| 9776 | 188777 | break; | |
| 9777 | |||
| 9778 | case aLEV: | ||
| 9779 | { | ||
| 9780 | 219227 | f4 = ((clk/5)&1); | |
| 9781 | |||
| 9782 |
4/5✓ Branch 0 taken 106859 times.
✓ Branch 1 taken 24845 times.
✓ Branch 2 taken 11238 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 76285 times.
|
219227 | switch(misc) |
| 9783 | { | ||
| 9784 | case -1: | ||
| 9785 | case 0: | ||
| 9786 | 106859 | return; | |
| 9787 | |||
| 9788 | case 1: | ||
| 9789 | |||
| 9790 | // case 5: tile += (f2) ? 1 : 0; cs = d->misc2; break; | ||
| 9791 | case 5: | ||
| 9792 | 24845 | tile += (f2) ? 1 : 0; | |
| 9793 | 24845 | cs = dmisc2; | |
| 9794 | 24845 | break; | |
| 9795 | |||
| 9796 | case 2: | ||
| 9797 | case 4: | ||
| 9798 | 11238 | tile += 2; | |
| 9799 | 11238 | break; | |
| 9800 | |||
| 9801 | case 3: | ||
| 9802 | 76285 | tile += (f4) ? 4 : 3; | |
| 9803 | 76285 | break; | |
| 9804 | } | ||
| 9805 | } | ||
| 9806 | 112368 | break; | |
| 9807 | |||
| 9808 | case aWALLM: | ||
| 9809 | { | ||
| 9810 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89141 times.
|
89141 | if(!dummy_bool[1]) |
| 9811 | { | ||
| 9812 | 89141 | tile += f2; | |
| 9813 | 89141 | } | |
| 9814 | } | ||
| 9815 | 89141 | break; | |
| 9816 | |||
| 9817 | case aNEWWALLM: | ||
| 9818 | { | ||
| 9819 | 207174 | int32_t tempdir=0; | |
| 9820 | |||
| 9821 |
4/4✓ Branch 0 taken 27129 times.
✓ Branch 1 taken 20687 times.
✓ Branch 2 taken 5822 times.
✓ Branch 3 taken 153536 times.
|
207174 | switch(misc) |
| 9822 | { | ||
| 9823 | case 1: | ||
| 9824 | case 2: | ||
| 9825 | 20687 | tempdir=clk3; | |
| 9826 | 20687 | break; | |
| 9827 | |||
| 9828 | case 3: | ||
| 9829 | case 4: | ||
| 9830 | case 5: | ||
| 9831 | 27129 | tempdir=dir; | |
| 9832 | 27129 | break; | |
| 9833 | |||
| 9834 | case 6: | ||
| 9835 | case 7: | ||
| 9836 | 5822 | tempdir=clk3^1; | |
| 9837 | 5822 | break; | |
| 9838 | } | ||
| 9839 | |||
| 9840 | 207174 | tiledir(tempdir,true); | |
| 9841 | |||
| 9842 |
2/2✓ Branch 0 taken 578 times.
✓ Branch 1 taken 206596 times.
|
207174 | if(!dummy_bool[1]) |
| 9843 | { | ||
| 9844 | 206596 | tile+=f4; | |
| 9845 | 206596 | } | |
| 9846 | } | ||
| 9847 | 207174 | break; | |
| 9848 | |||
| 9849 | case a4FRMNODIR: | ||
| 9850 | { | ||
| 9851 | 36233 | tile+=f4; | |
| 9852 | } | ||
| 9853 | 36233 | break; | |
| 9854 | |||
| 9855 | } // switch(d->anim) | ||
| 9856 | |||
| 9857 | // flashing | ||
| 9858 | // if(d->flags2 & guy_flashing) | ||
| 9859 |
2/2✓ Branch 0 taken 20108891 times.
✓ Branch 1 taken 508931 times.
|
20617822 | if(flags2 & guy_flashing) |
| 9860 | { | ||
| 9861 | 508931 | cs = (frame&3) + 6; | |
| 9862 | 508931 | } | |
| 9863 | |||
| 9864 |
2/2✓ Branch 0 taken 20585708 times.
✓ Branch 1 taken 32114 times.
|
20617822 | if(flags2&guy_transparent) |
| 9865 | { | ||
| 9866 | 32114 | drawstyle=1; | |
| 9867 | 32114 | } | |
| 9868 | |||
| 9869 | 20617822 | int32_t change = tile-basetile; | |
| 9870 | |||
| 9871 |
3/6✓ Branch 0 taken 530368 times.
✓ Branch 1 taken 20087454 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 530368 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
20617822 | if(extend > 2 && (!ignore_extend || get_bit(quest_rules, qr_BROKEN_BIG_ENEMY_ANIMATION))) |
| 9872 | { | ||
| 9873 |
2/2✓ Branch 0 taken 486406 times.
✓ Branch 1 taken 43962 times.
|
530368 | if(basetile/TILES_PER_ROW==(basetile+((txsz*change)/tilerows))/TILES_PER_ROW) |
| 9874 | { | ||
| 9875 | 486406 | tile=basetile+txsz*change; | |
| 9876 | 486406 | } | |
| 9877 | else | ||
| 9878 | { | ||
| 9879 | 43962 | tile=basetile+(txsz*change)+((tysz-1)*TILES_PER_ROW)*(((basetile+txsz*change)/TILES_PER_ROW)-(basetile/TILES_PER_ROW)); | |
| 9880 | } | ||
| 9881 | 530368 | } | |
| 9882 | else | ||
| 9883 | { | ||
| 9884 | 20087454 | tile=basetile+change; | |
| 9885 | } | ||
| 9886 | 20817598 | } | |
| 9887 | |||
| 9888 | 51050 | int32_t wpnsfx(int32_t wpn) | |
| 9889 | { | ||
| 9890 |
5/6✓ Branch 0 taken 17448 times.
✓ Branch 1 taken 283 times.
✓ Branch 2 taken 17447 times.
✓ Branch 3 taken 10387 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5485 times.
|
51050 | switch(wpn) |
| 9891 | { | ||
| 9892 | case ewFireTrail: | ||
| 9893 | case ewFlame: | ||
| 9894 | case ewFlame2Trail: | ||
| 9895 | case ewFlame2: | ||
| 9896 | 17448 | return WAV_FIRE; | |
| 9897 | |||
| 9898 | case ewWind: | ||
| 9899 | case ewMagic: | ||
| 9900 | 283 | return WAV_WAND; | |
| 9901 | |||
| 9902 | case ewIce: | ||
| 9903 | ✗ | return WAV_ZN1ICE; | |
| 9904 | |||
| 9905 | case ewRock: | ||
| 9906 |
2/2✓ Branch 0 taken 5221 times.
✓ Branch 1 taken 264 times.
|
5485 | if(get_bit(quest_rules,qr_MORESOUNDS)) return WAV_ZN1ROCK; |
| 9907 | 5221 | break; | |
| 9908 | |||
| 9909 | case ewFireball2: | ||
| 9910 | case ewFireball: | ||
| 9911 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 17440 times.
|
17447 | if(get_bit(quest_rules,qr_MORESOUNDS)) return WAV_ZN1FIREBALL; |
| 9912 | 17440 | } | |
| 9913 | |||
| 9914 | 33048 | return -1; | |
| 9915 | 51050 | } | |
| 9916 | |||
| 9917 | 39070332 | int32_t enemy::run_script(int32_t mode) | |
| 9918 | { | ||
| 9919 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 39070332 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39070332 | if(switch_hooked && !get_bit(quest_rules, qr_SWITCHOBJ_RUN_SCRIPT)) return RUNSCRIPT_OK; |
| 9920 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 39070332 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
39070332 | if (script <= 0 || !doscript || FFCore.getQuestHeaderInfo(vZelda) < 0x255 || FFCore.system_suspend[susptNPCSCRIPTS]) |
| 9921 | 39070332 | return RUNSCRIPT_OK; | |
| 9922 | ✗ | int32_t ret = RUNSCRIPT_OK; | |
| 9923 | ✗ | alloc_scriptmem(); | |
| 9924 | ✗ | switch(mode) | |
| 9925 | { | ||
| 9926 | case MODE_NORMAL: | ||
| 9927 | ✗ | return ZScriptVersion::RunScript(SCRIPT_NPC, script, getUID()); | |
| 9928 | case MODE_WAITDRAW: | ||
| 9929 | ✗ | if(waitdraw) | |
| 9930 | { | ||
| 9931 | ✗ | ret = ZScriptVersion::RunScript(SCRIPT_NPC, script, getUID()); | |
| 9932 | ✗ | waitdraw = 0; | |
| 9933 | ✗ | } | |
| 9934 | ✗ | break; | |
| 9935 | } | ||
| 9936 | ✗ | return ret; | |
| 9937 | 39070332 | } | |
| 9938 | ✗ | ALLEGRO_COLOR enemy::hitboxColor(byte opacity) const | |
| 9939 | { | ||
| 9940 | ✗ | return al_map_rgba(255,0,0,opacity); | |
| 9941 | } | ||
| 9942 | /********************************/ | ||
| 9943 | /********* Guy Class **********/ | ||
| 9944 | /********************************/ | ||
| 9945 | |||
| 9946 | // good guys, fires, fairy, and other non-enemies | ||
| 9947 | // based on enemy class b/c guys in dungeons act sort of like enemies | ||
| 9948 | // also easier to manage all the guys this way | ||
| 9949 | 2580 | guy::guy(zfix X,zfix Y,int32_t Id,int32_t Clk,bool mg) : enemy(X,Y,Id,Clk) | |
| 9950 | 2580 | { | |
| 9951 | 1290 | mainguy=mg; | |
| 9952 | 1290 | canfreeze=false; | |
| 9953 | 1290 | dir=down; | |
| 9954 |
3/6✓ Branch 0 taken 1290 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1290 times.
✓ Branch 4 taken 1290 times.
✗ Branch 5 not taken.
|
1290 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 9955 | 1290 | hxofs=2; | |
| 9956 | 1290 | hzsz=8; | |
| 9957 | 1290 | hxsz=12; | |
| 9958 | 1290 | hysz=17; | |
| 9959 | |||
| 9960 |
10/12✓ Branch 0 taken 1290 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1290 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 402 times.
✓ Branch 5 taken 888 times.
✓ Branch 6 taken 392 times.
✓ Branch 7 taken 10 times.
✓ Branch 8 taken 147 times.
✓ Branch 9 taken 245 times.
✓ Branch 10 taken 13 times.
✓ Branch 11 taken 134 times.
|
1290 | if(!superman && (!isdungeon() || id==gFAIRY || id==gFIRE || id==gZELDA)) |
| 9961 | { | ||
| 9962 | 1156 | superman = 1; | |
| 9963 | 1156 | hxofs=1000; | |
| 9964 | 1156 | } | |
| 9965 | 1290 | } | |
| 9966 | |||
| 9967 | 485064 | bool guy::animate(int32_t index) | |
| 9968 | { | ||
| 9969 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 485064 times.
|
485064 | if(switch_hooked) return enemy::animate(index); |
| 9970 |
6/6✓ Branch 0 taken 193139 times.
✓ Branch 1 taken 291925 times.
✓ Branch 2 taken 1751 times.
✓ Branch 3 taken 191388 times.
✓ Branch 4 taken 1184 times.
✓ Branch 5 taken 567 times.
|
485064 | if(mainguy && clk==0 && misc==0) |
| 9971 | { | ||
| 9972 | 567 | setupscreen(); | |
| 9973 | 567 | misc = 1; | |
| 9974 | 567 | } | |
| 9975 | |||
| 9976 |
4/4✓ Branch 0 taken 193139 times.
✓ Branch 1 taken 291925 times.
✓ Branch 2 taken 192952 times.
✓ Branch 3 taken 187 times.
|
485064 | if(mainguy && fadeclk==0) |
| 9977 | 187 | return true; | |
| 9978 | |||
| 9979 | 484877 | hp=256; // good guys never die... | |
| 9980 | |||
| 9981 |
4/4✓ Branch 0 taken 84 times.
✓ Branch 1 taken 484793 times.
✓ Branch 2 taken 81 times.
✓ Branch 3 taken 3 times.
|
484877 | if(hclk && !clk2) |
| 9982 | { | ||
| 9983 | // but if they get hit... | ||
| 9984 | 3 | ++clk2; // only do this once | |
| 9985 | |||
| 9986 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if(!get_bit(quest_rules,qr_NOGUYFIRES)) |
| 9987 | { | ||
| 9988 | 1 | addenemy(BSZ?64:72,68,eSHOOTFBALL,0); | |
| 9989 | 1 | addenemy(BSZ?176:168,68,eSHOOTFBALL,0); | |
| 9990 | 1 | } | |
| 9991 | 3 | } | |
| 9992 | |||
| 9993 | 484877 | return enemy::animate(index); | |
| 9994 | 485064 | } | |
| 9995 | |||
| 9996 | 487834 | void guy::draw(BITMAP *dest) | |
| 9997 | { | ||
| 9998 | 487834 | update_enemy_frame(); | |
| 9999 | |||
| 10000 |
6/6✓ Branch 0 taken 195781 times.
✓ Branch 1 taken 292053 times.
✓ Branch 2 taken 12593 times.
✓ Branch 3 taken 183188 times.
✓ Branch 4 taken 6295 times.
✓ Branch 5 taken 6298 times.
|
487834 | if(!mainguy || fadeclk<0 || fadeclk&1) |
| 10001 | 481536 | enemy::draw(dest); | |
| 10002 | 487834 | } | |
| 10003 | |||
| 10004 | /*******************************/ | ||
| 10005 | /********* Enemies *********/ | ||
| 10006 | /*******************************/ | ||
| 10007 | |||
| 10008 | 454 | eFire::eFire(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 10009 | 454 | { | |
| 10010 | 227 | clk4=0; | |
| 10011 | 227 | shield= (flags&(inv_left | inv_right | inv_back |inv_front)) != 0; | |
| 10012 | // Spawn type | ||
| 10013 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
|
227 | if(flags & guy_fadeflicker) |
| 10014 | { | ||
| 10015 | ✗ | clk=0; | |
| 10016 | ✗ | superman = 1; | |
| 10017 | ✗ | fading=fade_flicker; | |
| 10018 | ✗ | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; | |
| 10019 | ✗ | dir=down; | |
| 10020 | |||
| 10021 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10022 | ✗ | clk3=int32_t(13.0/step); | |
| 10023 | ✗ | } | |
| 10024 |
1/2✓ Branch 0 taken 227 times.
✗ Branch 1 not taken.
|
227 | else if(flags & guy_fadeinstant) |
| 10025 | { | ||
| 10026 | ✗ | clk=0; | |
| 10027 | ✗ | } | |
| 10028 | 227 | SIZEflags = d->SIZEflags; | |
| 10029 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
227 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 10030 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10031 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10032 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
227 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 10033 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
227 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 10034 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
227 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 10035 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
227 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 10036 |
1/2✓ Branch 0 taken 227 times.
✗ Branch 1 not taken.
|
227 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 10037 |
1/2✓ Branch 0 taken 227 times.
✗ Branch 1 not taken.
|
227 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 10038 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 10039 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
227 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 10040 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
|
227 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 10041 | { | ||
| 10042 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 10043 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 10044 | ✗ | } | |
| 10045 | |||
| 10046 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 227 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
227 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) d->zofs = (int32_t)zofs; |
| 10047 | 227 | } | |
| 10048 | |||
| 10049 | 57325 | bool eFire::animate(int32_t index) | |
| 10050 | { | ||
| 10051 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57325 times.
|
57325 | if(switch_hooked) return enemy::animate(index); |
| 10052 |
2/4✓ Branch 0 taken 57325 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 57325 times.
|
57325 | if(fallclk||drownclk) return enemy::animate(index); |
| 10053 |
2/2✓ Branch 0 taken 56930 times.
✓ Branch 1 taken 395 times.
|
57325 | if(fading) |
| 10054 | { | ||
| 10055 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 395 times.
|
395 | if(++clk4 > 60) |
| 10056 | { | ||
| 10057 | ✗ | clk4=0; | |
| 10058 | ✗ | superman=0; | |
| 10059 | ✗ | fading=0; | |
| 10060 | |||
| 10061 | ✗ | if(flags2&cmbflag_armos && z==0 && fakez==0) | |
| 10062 | ✗ | removearmos(x,y,ffcactivated); | |
| 10063 | |||
| 10064 | ✗ | clk2=0; | |
| 10065 | |||
| 10066 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10067 | { | ||
| 10068 | ✗ | dir=0; | |
| 10069 | ✗ | y = y.getInt() & 0xF0; | |
| 10070 | ✗ | } | |
| 10071 | |||
| 10072 | ✗ | return Dead(index); | |
| 10073 | } | ||
| 10074 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 395 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
395 | else if(flags2&cmbflag_armos && z==0 && fakez==0 && clk==0) |
| 10075 | ✗ | removearmos(x,y,ffcactivated); | |
| 10076 | 395 | } | |
| 10077 | |||
| 10078 | 57325 | return enemy::animate(index); | |
| 10079 | 57325 | } | |
| 10080 | |||
| 10081 | 117682 | void eFire::draw(BITMAP *dest) | |
| 10082 | { | ||
| 10083 | 117682 | update_enemy_frame(); | |
| 10084 | 117682 | enemy::draw(dest); | |
| 10085 | 117682 | } | |
| 10086 | |||
| 10087 | 119 | int32_t eFire::takehit(weapon *w, weapon* realweap) | |
| 10088 | { | ||
| 10089 | 119 | int32_t wpnId = w->id; | |
| 10090 | 119 | int32_t wpnDir = w->dir; | |
| 10091 | |||
| 10092 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 119 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
119 | if(wpnId==wHammer && shield && (flags & guy_bkshield) |
| 10093 | ✗ | && ((flags&inv_front && wpnDir==(dir^down)) || (flags&inv_back && wpnDir==(dir^up)) | |
| 10094 | ✗ | || (flags&inv_left && wpnDir==(dir^left)) || (flags&inv_right && wpnDir==(dir^right)))) | |
| 10095 | { | ||
| 10096 | ✗ | shield = false; | |
| 10097 | ✗ | flags &= ~(inv_left|inv_right|inv_back|inv_front); | |
| 10098 | |||
| 10099 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10100 | ✗ | o_tile=s_tile; | |
| 10101 | ✗ | } | |
| 10102 | |||
| 10103 | 119 | int32_t ret = enemy::takehit(w,realweap); | |
| 10104 | 119 | return ret; | |
| 10105 | } | ||
| 10106 | |||
| 10107 | ✗ | void eFire::break_shield() | |
| 10108 | { | ||
| 10109 | ✗ | if(!shield) | |
| 10110 | ✗ | return; | |
| 10111 | |||
| 10112 | ✗ | flags&=~(inv_front | inv_back | inv_left | inv_right); | |
| 10113 | ✗ | shield=false; | |
| 10114 | |||
| 10115 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10116 | ✗ | o_tile=s_tile; | |
| 10117 | ✗ | } | |
| 10118 | |||
| 10119 | 3570 | eOther::eOther(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 10120 | 3570 | { | |
| 10121 | //zprint2("npct other::other\n"); | ||
| 10122 | 1785 | clk4=0; | |
| 10123 | 1785 | shield= (flags&(inv_left | inv_right | inv_back |inv_front)) != 0; | |
| 10124 | |||
| 10125 | // Spawn type | ||
| 10126 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
|
1785 | if(flags & guy_fadeflicker) |
| 10127 | { | ||
| 10128 | ✗ | clk=0; | |
| 10129 | ✗ | superman = 1; | |
| 10130 | ✗ | fading=fade_flicker; | |
| 10131 | ✗ | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; | |
| 10132 | ✗ | dir=down; | |
| 10133 | |||
| 10134 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10135 | ✗ | clk3=int32_t(13.0/step); | |
| 10136 | ✗ | } | |
| 10137 |
2/2✓ Branch 0 taken 1761 times.
✓ Branch 1 taken 24 times.
|
1785 | else if(flags & guy_fadeinstant) |
| 10138 | { | ||
| 10139 | 24 | clk=0; | |
| 10140 | 24 | } | |
| 10141 | 1785 | SIZEflags = d->SIZEflags; | |
| 10142 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1785 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 10143 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10144 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10145 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1785 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 10146 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1785 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 10147 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1785 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 10148 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1785 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 10149 |
1/2✓ Branch 0 taken 1785 times.
✗ Branch 1 not taken.
|
1785 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 10150 |
1/2✓ Branch 0 taken 1785 times.
✗ Branch 1 not taken.
|
1785 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 10151 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 10152 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1785 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 10153 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
|
1785 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 10154 | { | ||
| 10155 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 10156 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 10157 | ✗ | } | |
| 10158 | |||
| 10159 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1785 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1785 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 10160 | 1785 | } | |
| 10161 | |||
| 10162 | 468746 | bool eOther::animate(int32_t index) | |
| 10163 | { | ||
| 10164 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 468746 times.
|
468746 | if(switch_hooked) return enemy::animate(index); |
| 10165 |
2/4✓ Branch 0 taken 468746 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 468746 times.
|
468746 | if(fallclk||drownclk) return enemy::animate(index); |
| 10166 | //zprint2("npct other::animate\n"); | ||
| 10167 |
2/2✓ Branch 0 taken 468521 times.
✓ Branch 1 taken 225 times.
|
468746 | if(fading) |
| 10168 | { | ||
| 10169 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 225 times.
|
225 | if(++clk4 > 60) |
| 10170 | { | ||
| 10171 | ✗ | clk4=0; | |
| 10172 | ✗ | superman=0; | |
| 10173 | ✗ | fading=0; | |
| 10174 | |||
| 10175 | ✗ | if(flags2&cmbflag_armos && z==0 && fakez==0) | |
| 10176 | ✗ | removearmos(x,y,ffcactivated); | |
| 10177 | |||
| 10178 | ✗ | clk2=0; | |
| 10179 | |||
| 10180 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10181 | { | ||
| 10182 | ✗ | dir=0; | |
| 10183 | ✗ | y = y.getInt() & 0xF0; | |
| 10184 | ✗ | } | |
| 10185 | |||
| 10186 | ✗ | return Dead(index); | |
| 10187 | } | ||
| 10188 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 225 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
225 | else if(flags2&cmbflag_armos && z==0 && fakez==0 && clk==0) |
| 10189 | ✗ | removearmos(x,y,ffcactivated); | |
| 10190 | 225 | } | |
| 10191 | |||
| 10192 | 468746 | return enemy::animate(index); | |
| 10193 | 468746 | } | |
| 10194 | |||
| 10195 | 487056 | void eOther::draw(BITMAP *dest) | |
| 10196 | { | ||
| 10197 | 487056 | update_enemy_frame(); | |
| 10198 | 487056 | enemy::draw(dest); | |
| 10199 | 487056 | } | |
| 10200 | |||
| 10201 | 3048 | int32_t eOther::takehit(weapon *w, weapon* realweap) | |
| 10202 | { | ||
| 10203 | 3048 | int32_t wpnId = w->id; | |
| 10204 | 3048 | int32_t wpnDir = w->dir; | |
| 10205 | |||
| 10206 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3031 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
3048 | if(wpnId==wHammer && shield && (flags & guy_bkshield) |
| 10207 | ✗ | && ((flags&inv_front && wpnDir==(dir^down)) || (flags&inv_back && wpnDir==(dir^up)) | |
| 10208 | ✗ | || (flags&inv_left && wpnDir==(dir^left)) || (flags&inv_right && wpnDir==(dir^right)))) | |
| 10209 | { | ||
| 10210 | ✗ | shield = false; | |
| 10211 | ✗ | flags &= ~(inv_left|inv_right|inv_back|inv_front); | |
| 10212 | |||
| 10213 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10214 | ✗ | o_tile=s_tile; | |
| 10215 | ✗ | } | |
| 10216 | |||
| 10217 | 3048 | int32_t ret = enemy::takehit(w,realweap); | |
| 10218 | 3048 | return ret; | |
| 10219 | } | ||
| 10220 | |||
| 10221 | ✗ | void eOther::break_shield() | |
| 10222 | { | ||
| 10223 | ✗ | if(!shield) | |
| 10224 | ✗ | return; | |
| 10225 | |||
| 10226 | ✗ | flags&=~(inv_front | inv_back | inv_left | inv_right); | |
| 10227 | ✗ | shield=false; | |
| 10228 | |||
| 10229 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10230 | ✗ | o_tile=s_tile; | |
| 10231 | ✗ | } | |
| 10232 | |||
| 10233 | |||
| 10234 | ✗ | eScript::eScript(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 10235 | ✗ | { | |
| 10236 | ✗ | clk4=0; | |
| 10237 | ✗ | shield= (flags&(inv_left | inv_right | inv_back |inv_front)) != 0; | |
| 10238 | |||
| 10239 | // Spawn type | ||
| 10240 | ✗ | if(flags & guy_fadeflicker) | |
| 10241 | { | ||
| 10242 | ✗ | clk=0; | |
| 10243 | ✗ | superman = 1; | |
| 10244 | ✗ | fading=fade_flicker; | |
| 10245 | ✗ | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; | |
| 10246 | ✗ | dir=down; | |
| 10247 | |||
| 10248 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10249 | ✗ | clk3=int32_t(13.0/step); | |
| 10250 | ✗ | } | |
| 10251 | ✗ | else if(flags & guy_fadeinstant) | |
| 10252 | { | ||
| 10253 | ✗ | clk=0; | |
| 10254 | ✗ | } | |
| 10255 | ✗ | SIZEflags = d->SIZEflags; | |
| 10256 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. | |
| 10257 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10258 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10259 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } | |
| 10260 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; | |
| 10261 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; | |
| 10262 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; | |
| 10263 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; | |
| 10264 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; | |
| 10265 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 10266 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; | |
| 10267 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) | |
| 10268 | { | ||
| 10269 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 10270 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 10271 | ✗ | } | |
| 10272 | |||
| 10273 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; | |
| 10274 | ✗ | } | |
| 10275 | |||
| 10276 | ✗ | bool eScript::animate(int32_t index) | |
| 10277 | { | ||
| 10278 | ✗ | if(switch_hooked) return enemy::animate(index); | |
| 10279 | ✗ | if(fallclk||drownclk) return enemy::animate(index); | |
| 10280 | ✗ | if(fading) | |
| 10281 | { | ||
| 10282 | ✗ | if(++clk4 > 60) | |
| 10283 | { | ||
| 10284 | ✗ | clk4=0; | |
| 10285 | ✗ | superman=0; | |
| 10286 | ✗ | fading=0; | |
| 10287 | |||
| 10288 | ✗ | if(flags2&cmbflag_armos && z==0 && fakez==0) | |
| 10289 | ✗ | removearmos(x,y,ffcactivated); | |
| 10290 | |||
| 10291 | ✗ | clk2=0; | |
| 10292 | |||
| 10293 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10294 | { | ||
| 10295 | ✗ | dir=0; | |
| 10296 | ✗ | y = y.getInt() & 0xF0; | |
| 10297 | ✗ | } | |
| 10298 | |||
| 10299 | ✗ | return Dead(index); | |
| 10300 | } | ||
| 10301 | ✗ | else if(flags2&cmbflag_armos && z==0 && fakez==0 && clk==0) | |
| 10302 | ✗ | removearmos(x,y,ffcactivated); | |
| 10303 | ✗ | } | |
| 10304 | |||
| 10305 | ✗ | return enemy::animate(index); | |
| 10306 | ✗ | } | |
| 10307 | |||
| 10308 | ✗ | void eScript::draw(BITMAP *dest) | |
| 10309 | { | ||
| 10310 | ✗ | update_enemy_frame(); | |
| 10311 | ✗ | enemy::draw(dest); | |
| 10312 | ✗ | } | |
| 10313 | |||
| 10314 | ✗ | int32_t eScript::takehit(weapon *w, weapon* realweap) | |
| 10315 | { | ||
| 10316 | ✗ | int32_t wpnId = w->id; | |
| 10317 | ✗ | int32_t wpnDir = w->dir; | |
| 10318 | |||
| 10319 | ✗ | if(wpnId==wHammer && shield && (flags & guy_bkshield) | |
| 10320 | ✗ | && ((flags&inv_front && wpnDir==(dir^down)) || (flags&inv_back && wpnDir==(dir^up)) | |
| 10321 | ✗ | || (flags&inv_left && wpnDir==(dir^left)) || (flags&inv_right && wpnDir==(dir^right)))) | |
| 10322 | { | ||
| 10323 | ✗ | shield = false; | |
| 10324 | ✗ | flags &= ~(inv_left|inv_right|inv_back|inv_front); | |
| 10325 | |||
| 10326 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10327 | ✗ | o_tile=s_tile; | |
| 10328 | ✗ | } | |
| 10329 | |||
| 10330 | ✗ | int32_t ret = enemy::takehit(w,realweap); | |
| 10331 | ✗ | return ret; | |
| 10332 | } | ||
| 10333 | |||
| 10334 | ✗ | void eScript::break_shield() | |
| 10335 | { | ||
| 10336 | ✗ | if(!shield) | |
| 10337 | ✗ | return; | |
| 10338 | |||
| 10339 | ✗ | flags&=~(inv_front | inv_back | inv_left | inv_right); | |
| 10340 | ✗ | shield=false; | |
| 10341 | |||
| 10342 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10343 | ✗ | o_tile=s_tile; | |
| 10344 | ✗ | } | |
| 10345 | |||
| 10346 | |||
| 10347 | ✗ | eFriendly::eFriendly(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 10348 | ✗ | { | |
| 10349 | ✗ | clk4=0; | |
| 10350 | ✗ | hyofs = -32768; //No hitbox initially. | |
| 10351 | ✗ | shield= (flags&(inv_left | inv_right | inv_back |inv_front)) != 0; | |
| 10352 | |||
| 10353 | // Spawn type | ||
| 10354 | ✗ | if(flags & guy_fadeflicker) | |
| 10355 | { | ||
| 10356 | ✗ | clk=0; | |
| 10357 | ✗ | superman = 1; | |
| 10358 | ✗ | fading=fade_flicker; | |
| 10359 | ✗ | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; | |
| 10360 | ✗ | dir=down; | |
| 10361 | |||
| 10362 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10363 | ✗ | clk3=int32_t(13.0/step); | |
| 10364 | ✗ | } | |
| 10365 | ✗ | else if(flags & guy_fadeinstant) | |
| 10366 | { | ||
| 10367 | ✗ | clk=0; | |
| 10368 | ✗ | } | |
| 10369 | ✗ | SIZEflags = d->SIZEflags; | |
| 10370 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. | |
| 10371 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10372 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10373 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } | |
| 10374 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; | |
| 10375 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; | |
| 10376 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; | |
| 10377 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; | |
| 10378 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; | |
| 10379 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 10380 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; | |
| 10381 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) | |
| 10382 | { | ||
| 10383 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 10384 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 10385 | ✗ | } | |
| 10386 | |||
| 10387 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; | |
| 10388 | ✗ | } | |
| 10389 | |||
| 10390 | ✗ | bool eFriendly::animate(int32_t index) | |
| 10391 | { | ||
| 10392 | ✗ | if(switch_hooked) return enemy::animate(index); | |
| 10393 | ✗ | if(fallclk||drownclk) return enemy::animate(index); | |
| 10394 | ✗ | if(fading) | |
| 10395 | { | ||
| 10396 | ✗ | if(++clk4 > 60) | |
| 10397 | { | ||
| 10398 | ✗ | clk4=0; | |
| 10399 | ✗ | superman=0; | |
| 10400 | ✗ | fading=0; | |
| 10401 | |||
| 10402 | ✗ | if(flags2&cmbflag_armos && z==0 && fakez==0) | |
| 10403 | ✗ | removearmos(x,y,ffcactivated); | |
| 10404 | |||
| 10405 | ✗ | clk2=0; | |
| 10406 | |||
| 10407 | ✗ | if(!canmove(down,(zfix)8,spw_none,false)) | |
| 10408 | { | ||
| 10409 | ✗ | dir=0; | |
| 10410 | ✗ | y = y.getInt() & 0xF0; | |
| 10411 | ✗ | } | |
| 10412 | |||
| 10413 | ✗ | return Dead(index); | |
| 10414 | } | ||
| 10415 | ✗ | else if(flags2&cmbflag_armos && z==0 && fakez==0 && clk==0) | |
| 10416 | ✗ | removearmos(x,y,ffcactivated); | |
| 10417 | ✗ | } | |
| 10418 | |||
| 10419 | ✗ | return enemy::animate(index); | |
| 10420 | ✗ | } | |
| 10421 | |||
| 10422 | ✗ | void eFriendly::draw(BITMAP *dest) | |
| 10423 | { | ||
| 10424 | ✗ | update_enemy_frame(); | |
| 10425 | ✗ | enemy::draw(dest); | |
| 10426 | ✗ | } | |
| 10427 | |||
| 10428 | ✗ | int32_t eFriendly::takehit(weapon *w, weapon* realweap) | |
| 10429 | { | ||
| 10430 | ✗ | int32_t wpnId = w->id; | |
| 10431 | ✗ | int32_t wpnDir = w->dir; | |
| 10432 | |||
| 10433 | ✗ | if(wpnId==wHammer && shield && (flags & guy_bkshield) | |
| 10434 | ✗ | && ((flags&inv_front && wpnDir==(dir^down)) || (flags&inv_back && wpnDir==(dir^up)) | |
| 10435 | ✗ | || (flags&inv_left && wpnDir==(dir^left)) || (flags&inv_right && wpnDir==(dir^right)))) | |
| 10436 | { | ||
| 10437 | ✗ | shield = false; | |
| 10438 | ✗ | flags &= ~(inv_left|inv_right|inv_back|inv_front); | |
| 10439 | |||
| 10440 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10441 | ✗ | o_tile=s_tile; | |
| 10442 | ✗ | } | |
| 10443 | |||
| 10444 | ✗ | int32_t ret = enemy::takehit(w,realweap); | |
| 10445 | ✗ | return ret; | |
| 10446 | } | ||
| 10447 | |||
| 10448 | ✗ | void eFriendly::break_shield() | |
| 10449 | { | ||
| 10450 | ✗ | if(!shield) | |
| 10451 | ✗ | return; | |
| 10452 | |||
| 10453 | ✗ | flags&=~(inv_front | inv_back | inv_left | inv_right); | |
| 10454 | ✗ | shield=false; | |
| 10455 | |||
| 10456 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 10457 | ✗ | o_tile=s_tile; | |
| 10458 | ✗ | } | |
| 10459 | |||
| 10460 | |||
| 10461 | 332509 | void enemy::removearmos(int32_t ax,int32_t ay, word ffcactive) | |
| 10462 | { | ||
| 10463 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332509 times.
|
332509 | if (ffcactive) |
| 10464 | { | ||
| 10465 | ✗ | removearmosffc(ffcactive-1); | |
| 10466 | ✗ | return; | |
| 10467 | } | ||
| 10468 |
2/2✓ Branch 0 taken 331859 times.
✓ Branch 1 taken 650 times.
|
332509 | if(did_armos) |
| 10469 | { | ||
| 10470 | 331859 | return; | |
| 10471 | } | ||
| 10472 | |||
| 10473 | 650 | did_armos=true; | |
| 10474 | 650 | ax&=0xF0; | |
| 10475 | 650 | ay&=0xF0; | |
| 10476 | 650 | int32_t cd = (ax>>4)+ay; | |
| 10477 | 650 | int32_t f = MAPFLAG(ax,ay); | |
| 10478 | 650 | int32_t f2 = MAPCOMBOFLAG(ax,ay); | |
| 10479 | |||
| 10480 |
2/2✓ Branch 0 taken 540 times.
✓ Branch 1 taken 110 times.
|
650 | if(combobuf[tmpscr->data[cd]].type!=cARMOS) |
| 10481 | { | ||
| 10482 | 540 | return; | |
| 10483 | } | ||
| 10484 | |||
| 10485 | 110 | tmpscr->data[cd] = tmpscr->undercombo; | |
| 10486 | 110 | tmpscr->cset[cd] = tmpscr->undercset; | |
| 10487 | 110 | tmpscr->sflag[cd] = 0; | |
| 10488 | |||
| 10489 |
3/4✓ Branch 0 taken 90 times.
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 90 times.
|
110 | if(f == mfARMOS_SECRET || f2 == mfARMOS_SECRET) |
| 10490 | { | ||
| 10491 | 20 | tmpscr->data[cd] = tmpscr->secretcombo[sSTAIRS]; | |
| 10492 | 20 | tmpscr->cset[cd] = tmpscr->secretcset[sSTAIRS]; | |
| 10493 | 20 | tmpscr->sflag[cd]=tmpscr->secretflag[sSTAIRS]; | |
| 10494 | 20 | sfx(tmpscr->secretsfx); | |
| 10495 | 20 | } | |
| 10496 | |||
| 10497 |
3/4✓ Branch 0 taken 108 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 108 times.
|
110 | if(f == mfARMOS_ITEM || f2 == mfARMOS_ITEM) |
| 10498 | { | ||
| 10499 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2 | if(!getmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN)) |
| 10500 | { | ||
| 10501 | 2 | additem(ax,ay,tmpscr->catchall, (ipONETIME2 + ipBIGRANGE) | ((tmpscr->flags3&fHOLDITEM) ? ipHOLDUP : 0) | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 10502 | 2 | sfx(tmpscr->secretsfx); | |
| 10503 | 2 | } | |
| 10504 | 2 | } | |
| 10505 | |||
| 10506 | 110 | putcombo(scrollbuf,ax,ay,tmpscr->data[cd],tmpscr->cset[cd]); | |
| 10507 | 332509 | } | |
| 10508 | |||
| 10509 | ✗ | void enemy::removearmosffc(int32_t pos) | |
| 10510 | { | ||
| 10511 | ✗ | if(did_armos) | |
| 10512 | { | ||
| 10513 | ✗ | return; | |
| 10514 | } | ||
| 10515 | |||
| 10516 | ✗ | did_armos=true; | |
| 10517 | ✗ | ffcdata& ffc = tmpscr->ffcs[pos]; | |
| 10518 | ✗ | newcombo const& cmb = combobuf[ffc.getData()]; | |
| 10519 | ✗ | int32_t f2 = cmb.flag; | |
| 10520 | |||
| 10521 | ✗ | if(cmb.type!=cARMOS) | |
| 10522 | { | ||
| 10523 | ✗ | return; | |
| 10524 | } | ||
| 10525 | |||
| 10526 | ✗ | ffc.setData(tmpscr->undercombo); | |
| 10527 | ✗ | ffc.cset = tmpscr->undercset; | |
| 10528 | |||
| 10529 | ✗ | if(f2 == mfARMOS_SECRET) | |
| 10530 | { | ||
| 10531 | ✗ | ffc.setData(tmpscr->secretcombo[sSTAIRS]); | |
| 10532 | ✗ | ffc.cset = tmpscr->secretcset[sSTAIRS]; | |
| 10533 | ✗ | sfx(tmpscr->secretsfx); | |
| 10534 | ✗ | } | |
| 10535 | |||
| 10536 | ✗ | if(f2 == mfARMOS_ITEM) | |
| 10537 | { | ||
| 10538 | ✗ | if(!getmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN)) | |
| 10539 | { | ||
| 10540 | ✗ | additem(ffc.x,ffc.y,tmpscr->catchall, (ipONETIME2 + ipBIGRANGE) | ((tmpscr->flags3&fHOLDITEM) ? ipHOLDUP : 0) | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 10541 | ✗ | sfx(tmpscr->secretsfx); | |
| 10542 | ✗ | } | |
| 10543 | ✗ | } | |
| 10544 | |||
| 10545 | ✗ | putcombo(scrollbuf,ffc.x,ffc.y,ffc.getData(),ffc.cset); | |
| 10546 | ✗ | } | |
| 10547 | |||
| 10548 | |||
| 10549 | 278 | eGhini::eGhini(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 10550 | 278 | { | |
| 10551 | 139 | fading=fade_flicker; | |
| 10552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
|
139 | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; |
| 10553 | 139 | dir=12; | |
| 10554 | 139 | movestatus=1; | |
| 10555 |
1/2✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
|
139 | step=0; |
| 10556 | 139 | clk=0; | |
| 10557 | 139 | clk4=0; | |
| 10558 | 139 | SIZEflags = d->SIZEflags; | |
| 10559 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
139 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 10560 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10561 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10562 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
139 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 10563 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
139 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 10564 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
139 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 10565 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
139 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 10566 |
1/2✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
|
139 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 10567 |
1/2✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
|
139 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 10568 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 10569 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
139 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 10570 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
|
139 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 10571 | { | ||
| 10572 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 10573 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 10574 | ✗ | } | |
| 10575 | |||
| 10576 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
139 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 10577 | 139 | } | |
| 10578 | |||
| 10579 | 50941 | bool eGhini::animate(int32_t index) | |
| 10580 | { | ||
| 10581 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50941 times.
|
50941 | if(switch_hooked) return enemy::animate(index); |
| 10582 |
2/4✓ Branch 0 taken 50941 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 50941 times.
|
50941 | if(fallclk||drownclk) return enemy::animate(index); |
| 10583 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 50905 times.
|
50941 | if(dying) |
| 10584 | 36 | return Dead(index); | |
| 10585 | |||
| 10586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50905 times.
|
50905 | if(dmisc1) |
| 10587 | { | ||
| 10588 |
2/2✓ Branch 0 taken 42559 times.
✓ Branch 1 taken 8346 times.
|
50905 | if(misc) |
| 10589 | { | ||
| 10590 |
2/2✓ Branch 0 taken 11685 times.
✓ Branch 1 taken 30874 times.
|
42559 | if(clk4>160) |
| 10591 | 30874 | misc=2; | |
| 10592 | |||
| 10593 |
2/2✓ Branch 0 taken 11685 times.
✓ Branch 1 taken 30874 times.
|
42559 | floater_walk((misc==1)?0:rate,hrate,zslongToFix(dstep*100),zslongToFix(dstep*10),10,dmisc16,dmisc17); //120,10); |
| 10594 | 42559 | removearmos(x,y,ffcactivated); | |
| 10595 | 42559 | } | |
| 10596 |
2/2✓ Branch 0 taken 8212 times.
✓ Branch 1 taken 134 times.
|
8346 | else if(clk4>=60) |
| 10597 | { | ||
| 10598 | 134 | misc=1; | |
| 10599 | 134 | clk3=32; | |
| 10600 | 134 | fading=0; | |
| 10601 |
1/2✓ Branch 0 taken 134 times.
✗ Branch 1 not taken.
|
134 | if (ffcactivated > 0) |
| 10602 | { | ||
| 10603 | ✗ | guygridffc[ffcactivated-1] = 0; | |
| 10604 | ✗ | removearmosffc(ffcactivated-1); | |
| 10605 | ✗ | } | |
| 10606 | else | ||
| 10607 | { | ||
| 10608 | 134 | guygrid[(int32_t(y)&0xF0)+(int32_t(x)>>4)]=0; | |
| 10609 | 134 | removearmos(x,y); | |
| 10610 | } | ||
| 10611 | 134 | } | |
| 10612 | 50905 | } | |
| 10613 | |||
| 10614 | 50905 | clk4++; | |
| 10615 | |||
| 10616 | 50905 | return enemy::animate(index); | |
| 10617 | 50941 | } | |
| 10618 | |||
| 10619 | 101940 | void eGhini::draw(BITMAP *dest) | |
| 10620 | { | ||
| 10621 | 101940 | update_enemy_frame(); | |
| 10622 | 101940 | enemy::draw(dest); | |
| 10623 | 101940 | } | |
| 10624 | |||
| 10625 | 2 | void eGhini::kickbucket() | |
| 10626 | { | ||
| 10627 | 2 | hp=-1000; // don't call death_sfx() | |
| 10628 | 2 | } | |
| 10629 | |||
| 10630 |
3/6✓ Branch 0 taken 2388 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2388 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2388 times.
✗ Branch 5 not taken.
|
7164 | eTektite::eTektite(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) |
| 10631 | 4776 | { | |
| 10632 |
1/2✓ Branch 0 taken 2388 times.
✗ Branch 1 not taken.
|
2388 | old_y=y; |
| 10633 | 2388 | dir=down; | |
| 10634 | 2388 | misc=1; | |
| 10635 | 2388 | clk=-15; | |
| 10636 | |||
| 10637 |
2/2✓ Branch 0 taken 2368 times.
✓ Branch 1 taken 20 times.
|
2388 | if(!BSZ) |
| 10638 |
1/2✓ Branch 0 taken 2368 times.
✗ Branch 1 not taken.
|
2368 | clk*=zc_oldrand()%3+1; |
| 10639 | |||
| 10640 | // avoid divide by 0 errors | ||
| 10641 |
1/2✓ Branch 0 taken 2388 times.
✗ Branch 1 not taken.
|
2388 | if(dmisc1 == 0) |
| 10642 | ✗ | dmisc1 = 24; | |
| 10643 | |||
| 10644 |
1/2✓ Branch 0 taken 2388 times.
✗ Branch 1 not taken.
|
2388 | if(dmisc2 == 0) |
| 10645 | ✗ | dmisc2 = 3; | |
| 10646 | |||
| 10647 | //nets+760; | ||
| 10648 | 2388 | SIZEflags = d->SIZEflags; | |
| 10649 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2388 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 10650 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10651 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10652 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2388 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 10653 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2388 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 10654 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2388 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 10655 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2388 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 10656 |
1/2✓ Branch 0 taken 2388 times.
✗ Branch 1 not taken.
|
2388 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 10657 |
1/2✓ Branch 0 taken 2388 times.
✗ Branch 1 not taken.
|
2388 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 10658 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 10659 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2388 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 10660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
|
2388 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 10661 | { | ||
| 10662 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 10663 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 10664 | ✗ | } | |
| 10665 | |||
| 10666 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2388 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2388 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 10667 | 2388 | } | |
| 10668 | |||
| 10669 | 784066 | bool eTektite::animate(int32_t index) | |
| 10670 | { | ||
| 10671 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784066 times.
|
784066 | if(switch_hooked) return enemy::animate(index); |
| 10672 |
4/4✓ Branch 0 taken 780002 times.
✓ Branch 1 taken 4064 times.
✓ Branch 2 taken 4064 times.
✓ Branch 3 taken 784066 times.
|
784066 | if(fallclk||drownclk) return enemy::animate(index); |
| 10673 |
2/2✓ Branch 0 taken 17409 times.
✓ Branch 1 taken 766657 times.
|
784066 | if(dying) |
| 10674 | 17409 | return Dead(index); | |
| 10675 | |||
| 10676 |
2/2✓ Branch 0 taken 747176 times.
✓ Branch 1 taken 19481 times.
|
766657 | if(clk==0) |
| 10677 | { | ||
| 10678 | 19481 | removearmos(x,y,ffcactivated); | |
| 10679 | 19481 | } | |
| 10680 | |||
| 10681 |
2/2✓ Branch 0 taken 433523 times.
✓ Branch 1 taken 333134 times.
|
766657 | if(get_bit(quest_rules,qr_ENEMIESZAXIS)) |
| 10682 | { | ||
| 10683 | 333134 | y=floor_y; | |
| 10684 | 333134 | } | |
| 10685 | |||
| 10686 |
9/10✓ Branch 0 taken 691590 times.
✓ Branch 1 taken 75067 times.
✓ Branch 2 taken 686670 times.
✓ Branch 3 taken 4920 times.
✓ Branch 4 taken 686670 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10838 times.
✓ Branch 7 taken 675832 times.
✓ Branch 8 taken 5310 times.
✓ Branch 9 taken 9636 times.
|
766657 | if(clk>=0 && !stunclk && !frozenclock && (!watch || misc==0)) |
| 10687 | { | ||
| 10688 |
4/4✓ Branch 0 taken 8172 times.
✓ Branch 1 taken 274734 times.
✓ Branch 2 taken 175996 times.
✓ Branch 3 taken 226566 times.
|
685468 | switch(misc) |
| 10689 | { | ||
| 10690 | case 0: // normal | ||
| 10691 |
2/2✓ Branch 0 taken 269013 times.
✓ Branch 1 taken 5721 times.
|
274734 | if(!(zc_oldrand()%dmisc1)) |
| 10692 | { | ||
| 10693 | 5721 | misc=1; | |
| 10694 | 5721 | clk2=32; | |
| 10695 | 5721 | } | |
| 10696 | |||
| 10697 | 274734 | break; | |
| 10698 | |||
| 10699 | case 1: // waiting to pounce | ||
| 10700 |
2/2✓ Branch 0 taken 166722 times.
✓ Branch 1 taken 9274 times.
|
175996 | if(--clk2<=0) |
| 10701 | { | ||
| 10702 | 9274 | int32_t r=zc_oldrand(); | |
| 10703 | 9274 | misc=2; | |
| 10704 | 9274 | step=0-(zslongToFix(dstep*100)); // initial speed | |
| 10705 | 9274 | clk3=(r&1)+2; // left or right | |
| 10706 | 9274 | clk2start=clk2=(r&31)+10; // flight time | |
| 10707 | |||
| 10708 |
2/2✓ Branch 0 taken 8102 times.
✓ Branch 1 taken 1172 times.
|
9274 | if(y<32) clk2+=2; // make them come down from top of screen |
| 10709 | |||
| 10710 |
2/2✓ Branch 0 taken 7180 times.
✓ Branch 1 taken 2094 times.
|
9274 | if(y>112) clk2-=2; // make them go back up |
| 10711 | |||
| 10712 | 9274 | cstart=c = 9-((r&31)>>3); // time before gravity kicks in | |
| 10713 | 9274 | } | |
| 10714 | |||
| 10715 | 175996 | break; | |
| 10716 | |||
| 10717 | case 2: // in flight | ||
| 10718 | 226566 | move(step); | |
| 10719 | |||
| 10720 |
2/2✓ Branch 0 taken 109038 times.
✓ Branch 1 taken 117528 times.
|
226566 | if(step>0) //going down |
| 10721 | { | ||
| 10722 |
2/2✓ Branch 0 taken 156 times.
✓ Branch 1 taken 108882 times.
|
109038 | if(COMBOTYPE(x+8,y+16)==cNOJUMPZONE) |
| 10723 | { | ||
| 10724 | 156 | step=0-step; | |
| 10725 | 156 | } | |
| 10726 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108882 times.
|
108882 | else if(COMBOTYPE(x+8,y+16)==cNOENEMY) |
| 10727 | { | ||
| 10728 | ✗ | step=0-step; | |
| 10729 | ✗ | } | |
| 10730 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108882 times.
|
108882 | else if(ispitfall(x+8,y+16)) |
| 10731 | { | ||
| 10732 | ✗ | step=0-step; | |
| 10733 | ✗ | } | |
| 10734 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 108882 times.
|
108882 | else if(MAPFLAG(x+8,y+16)==mfNOENEMY) |
| 10735 | { | ||
| 10736 | ✗ | step=0-step; | |
| 10737 | ✗ | } | |
| 10738 |
1/2✓ Branch 0 taken 108882 times.
✗ Branch 1 not taken.
|
108882 | else if(MAPCOMBOFLAG(x+8,y+16)==mfNOENEMY) |
| 10739 | { | ||
| 10740 | ✗ | step=0-step; | |
| 10741 | ✗ | } | |
| 10742 | 109038 | } | |
| 10743 |
2/2✓ Branch 0 taken 7567 times.
✓ Branch 1 taken 109961 times.
|
117528 | else if(step<0) |
| 10744 | { | ||
| 10745 |
2/2✓ Branch 0 taken 219 times.
✓ Branch 1 taken 109742 times.
|
109961 | if(COMBOTYPE(x+8,y)==cNOJUMPZONE) |
| 10746 | { | ||
| 10747 | 219 | step=0-step; | |
| 10748 | 219 | } | |
| 10749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 109742 times.
|
109742 | else if(COMBOTYPE(x+8,y)==cNOENEMY) |
| 10750 | { | ||
| 10751 | ✗ | step=0-step; | |
| 10752 | ✗ | } | |
| 10753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 109742 times.
|
109742 | else if(ispitfall(x+8,y)) |
| 10754 | { | ||
| 10755 | ✗ | step=0-step; | |
| 10756 | ✗ | } | |
| 10757 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 109742 times.
|
109742 | else if(MAPFLAG(x+8,y)==mfNOENEMY) |
| 10758 | { | ||
| 10759 | ✗ | step=0-step; | |
| 10760 | ✗ | } | |
| 10761 |
1/2✓ Branch 0 taken 109742 times.
✗ Branch 1 not taken.
|
109742 | else if(MAPCOMBOFLAG(x+8,y)==mfNOENEMY) |
| 10762 | { | ||
| 10763 | ✗ | step=0-step; | |
| 10764 | ✗ | } | |
| 10765 | 109961 | } | |
| 10766 | |||
| 10767 |
2/2✓ Branch 0 taken 112812 times.
✓ Branch 1 taken 113754 times.
|
226566 | if(clk3==left) |
| 10768 | { | ||
| 10769 |
2/2✓ Branch 0 taken 101 times.
✓ Branch 1 taken 112711 times.
|
112812 | if(COMBOTYPE(x,y+8)==cNOJUMPZONE) |
| 10770 | { | ||
| 10771 | 101 | clk3^=1; | |
| 10772 | 101 | } | |
| 10773 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112711 times.
|
112711 | else if(COMBOTYPE(x,y+8)==cNOENEMY) |
| 10774 | { | ||
| 10775 | ✗ | clk3^=1; | |
| 10776 | ✗ | } | |
| 10777 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112711 times.
|
112711 | else if(ispitfall(x,y+8)) |
| 10778 | { | ||
| 10779 | ✗ | clk3^=1; | |
| 10780 | ✗ | } | |
| 10781 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 112711 times.
|
112711 | else if(MAPFLAG(x,y+8)==mfNOENEMY) |
| 10782 | { | ||
| 10783 | ✗ | clk3^=1; | |
| 10784 | ✗ | } | |
| 10785 |
1/2✓ Branch 0 taken 112711 times.
✗ Branch 1 not taken.
|
112711 | else if(MAPCOMBOFLAG(x,y+8)==mfNOENEMY) |
| 10786 | { | ||
| 10787 | ✗ | clk3^=1; | |
| 10788 | ✗ | } | |
| 10789 | 112812 | } | |
| 10790 | else | ||
| 10791 | { | ||
| 10792 |
2/2✓ Branch 0 taken 91 times.
✓ Branch 1 taken 113663 times.
|
113754 | if(COMBOTYPE(x+16,y+8)==cNOJUMPZONE) |
| 10793 | { | ||
| 10794 | 91 | clk3^=1; | |
| 10795 | 91 | } | |
| 10796 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113663 times.
|
113663 | else if(COMBOTYPE(x+16,y+8)==cNOENEMY) |
| 10797 | { | ||
| 10798 | ✗ | clk3^=1; | |
| 10799 | ✗ | } | |
| 10800 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113663 times.
|
113663 | else if(ispitfall(x+16,y+8)) |
| 10801 | { | ||
| 10802 | ✗ | clk3^=1; | |
| 10803 | ✗ | } | |
| 10804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113663 times.
|
113663 | else if(MAPFLAG(x+16,y+8)==mfNOENEMY) |
| 10805 | { | ||
| 10806 | ✗ | clk3^=1; | |
| 10807 | ✗ | } | |
| 10808 |
1/2✓ Branch 0 taken 113663 times.
✗ Branch 1 not taken.
|
113663 | else if(MAPCOMBOFLAG(x+16,y+8)==mfNOENEMY) |
| 10809 | { | ||
| 10810 | ✗ | clk3^=1; | |
| 10811 | ✗ | } | |
| 10812 | } | ||
| 10813 | |||
| 10814 | 226566 | --c; | |
| 10815 | |||
| 10816 |
4/4✓ Branch 0 taken 68355 times.
✓ Branch 1 taken 158211 times.
✓ Branch 2 taken 148988 times.
✓ Branch 3 taken 77578 times.
|
226566 | if(c<0 && step<zslongToFix(dstep*100)) |
| 10817 | { | ||
| 10818 | 77578 | step+=zslongToFix(dmisc3*100); | |
| 10819 | 77578 | } | |
| 10820 | |||
| 10821 | 226566 | int32_t nb=get_bit(quest_rules,qr_NOBORDER) ? 16 : 0; | |
| 10822 | |||
| 10823 |
2/2✓ Branch 0 taken 226320 times.
✓ Branch 1 taken 246 times.
|
226566 | if(x<=16-nb) clk3=right; |
| 10824 | |||
| 10825 |
2/2✓ Branch 0 taken 226106 times.
✓ Branch 1 taken 460 times.
|
226566 | if(x>=224+nb) clk3=left; |
| 10826 | |||
| 10827 | 226566 | x += (clk3==left) ? -1 : 1; | |
| 10828 | |||
| 10829 |
4/4✓ Branch 0 taken 12808 times.
✓ Branch 1 taken 213758 times.
✓ Branch 2 taken 4091 times.
✓ Branch 3 taken 209667 times.
|
226566 | if((--clk2<=0 && y>=16-nb) || y>=144+nb) |
| 10830 | { | ||
| 10831 |
4/4✓ Branch 0 taken 539 times.
✓ Branch 1 taken 8188 times.
✓ Branch 2 taken 362 times.
✓ Branch 3 taken 177 times.
|
16899 | if(y>=144+nb && get_bit(quest_rules,qr_ENEMIESZAXIS)) |
| 10832 | { | ||
| 10833 | 177 | step=0-step; | |
| 10834 | 177 | y--; | |
| 10835 | 177 | } | |
| 10836 |
2/2✓ Branch 0 taken 6697 times.
✓ Branch 1 taken 1853 times.
|
8550 | else if(zc_oldrand()%dmisc2) //land and wait |
| 10837 | { | ||
| 10838 | 6697 | clk=misc=0; | |
| 10839 | 6697 | } //land and jump again | |
| 10840 | else | ||
| 10841 | { | ||
| 10842 | 1853 | misc=1; | |
| 10843 | 1853 | clk2=0; | |
| 10844 | } | ||
| 10845 | 8727 | } | |
| 10846 | |||
| 10847 | 218394 | break; | |
| 10848 | } // switch | ||
| 10849 | 677296 | } | |
| 10850 | |||
| 10851 |
4/4✓ Branch 0 taken 333134 times.
✓ Branch 1 taken 429459 times.
✓ Branch 2 taken 226451 times.
✓ Branch 3 taken 106683 times.
|
762593 | if(get_bit(quest_rules,qr_ENEMIESZAXIS) && misc==2) |
| 10852 | { | ||
| 10853 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106683 times.
|
106683 | if (moveflags & FLAG_USE_FAKE_Z) |
| 10854 | { | ||
| 10855 | ✗ | int32_t tempy = floor_y; | |
| 10856 | ✗ | fakez=zc_max(0,zc_min(clk2start-clk2,clk2)); | |
| 10857 | ✗ | floor_y = y; | |
| 10858 | ✗ | y=tempy-fakez; | |
| 10859 | ✗ | old_y = y; | |
| 10860 | ✗ | } | |
| 10861 | else | ||
| 10862 | { | ||
| 10863 | 106683 | int32_t tempy = floor_y; | |
| 10864 |
6/6✓ Branch 0 taken 53507 times.
✓ Branch 1 taken 53176 times.
✓ Branch 2 taken 2353 times.
✓ Branch 3 taken 104330 times.
✓ Branch 4 taken 52359 times.
✓ Branch 5 taken 51971 times.
|
106683 | z=zc_max(0,zc_min(clk2start-clk2,clk2)); |
| 10865 | 106683 | floor_y = y; | |
| 10866 | 106683 | y=tempy-z; | |
| 10867 | 106683 | old_y = y; | |
| 10868 | } | ||
| 10869 | 106683 | } | |
| 10870 | |||
| 10871 |
4/4✓ Branch 0 taken 4920 times.
✓ Branch 1 taken 757673 times.
✓ Branch 2 taken 978 times.
✓ Branch 3 taken 3942 times.
|
762593 | if(stunclk && (clk&31)==1) |
| 10872 | 3942 | clk=0; | |
| 10873 | |||
| 10874 | 762593 | return enemy::animate(index); | |
| 10875 | 780002 | } | |
| 10876 | |||
| 10877 | 205194 | void eTektite::drawshadow(BITMAP *dest,bool translucent) | |
| 10878 | { | ||
| 10879 |
5/6✓ Branch 0 taken 35638 times.
✓ Branch 1 taken 169556 times.
✓ Branch 2 taken 35638 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11304 times.
✓ Branch 5 taken 24334 times.
|
205194 | if(z<1 && fakez<1 && get_bit(quest_rules,qr_ENEMIESZAXIS)) |
| 10880 | 24334 | return; | |
| 10881 | |||
| 10882 | 180860 | int32_t tempy=yofs; | |
| 10883 | 180860 | int32_t fdiv = frate/4; | |
| 10884 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 180860 times.
|
180860 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 10885 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 180860 times.
|
180860 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 10886 | 180860 | efrate:((clk>=(frate>>1))?1:0); | |
| 10887 | 180860 | flip = 0; | |
| 10888 | 180860 | shadowtile = wpnsbuf[spr_shadow].tile; | |
| 10889 | |||
| 10890 |
1/2✓ Branch 0 taken 180860 times.
✗ Branch 1 not taken.
|
180860 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 10891 | { | ||
| 10892 |
2/2✓ Branch 0 taken 68075 times.
✓ Branch 1 taken 112785 times.
|
180860 | if(misc==0) |
| 10893 | { | ||
| 10894 | 68075 | shadowtile+=f2; | |
| 10895 | 68075 | } | |
| 10896 |
2/2✓ Branch 0 taken 50479 times.
✓ Branch 1 taken 62306 times.
|
112785 | else if(misc!=1) |
| 10897 | 62306 | shadowtile+=2; | |
| 10898 | 180860 | } | |
| 10899 | else | ||
| 10900 | { | ||
| 10901 | ✗ | if(misc==0) | |
| 10902 | { | ||
| 10903 | ✗ | shadowtile += f2 ? 1 : 0; | |
| 10904 | ✗ | } | |
| 10905 | ✗ | else if(misc!=1) | |
| 10906 | { | ||
| 10907 | ✗ | ++shadowtile; | |
| 10908 | ✗ | } | |
| 10909 | } | ||
| 10910 | |||
| 10911 | 180860 | yofs+=8; | |
| 10912 | |||
| 10913 |
4/4✓ Branch 0 taken 11304 times.
✓ Branch 1 taken 169556 times.
✓ Branch 2 taken 5927 times.
✓ Branch 3 taken 5377 times.
|
180860 | if(!get_bit(quest_rules,qr_ENEMIESZAXIS) && misc==2) |
| 10914 | { | ||
| 10915 |
6/6✓ Branch 0 taken 2662 times.
✓ Branch 1 taken 2715 times.
✓ Branch 2 taken 320 times.
✓ Branch 3 taken 5057 times.
✓ Branch 4 taken 2556 times.
✓ Branch 5 taken 2501 times.
|
5377 | yofs+=zc_max(0,zc_min(clk2start-clk2,clk2)); |
| 10916 | 5377 | } | |
| 10917 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 180860 times.
|
180860 | if(!shadow_overpit(this)) |
| 10918 | 180860 | enemy::drawshadow(dest,translucent); | |
| 10919 | 180860 | yofs=tempy; | |
| 10920 | 205194 | } | |
| 10921 | |||
| 10922 | 1375168 | void eTektite::draw(BITMAP *dest) | |
| 10923 | { | ||
| 10924 | 1375168 | update_enemy_frame(); | |
| 10925 | 1375168 | enemy::draw(dest); | |
| 10926 | 1375168 | } | |
| 10927 | |||
| 10928 | 766 | eItemFairy::eItemFairy(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 10929 | 766 | { | |
| 10930 |
2/4✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 383 times.
✗ Branch 3 not taken.
|
383 | step=zslongToFix(guysbuf[id&0xFFF].step*100); |
| 10931 | 383 | superman=1; | |
| 10932 | 383 | dir=8; | |
| 10933 | 383 | hxofs=1000; | |
| 10934 | 383 | mainguy=false; | |
| 10935 | 383 | count_enemy=false; | |
| 10936 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
383 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 10937 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10938 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10939 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
383 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = tysz; if ( tysz > 1 ) extend = 3; } |
| 10940 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
383 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = hxsz; |
| 10941 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
383 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = hysz; |
| 10942 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
383 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = hzsz; |
| 10943 |
1/2✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
|
383 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = hxofs; |
| 10944 |
1/2✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
|
383 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = hyofs; |
| 10945 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 10946 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
383 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)xofs; |
| 10947 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
|
383 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 10948 | { | ||
| 10949 | ✗ | yofs = (int32_t)yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 10950 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 10951 | ✗ | } | |
| 10952 | |||
| 10953 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
383 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)zofs; |
| 10954 | 383 | } | |
| 10955 | |||
| 10956 | 217928 | bool eItemFairy::animate(int32_t index) | |
| 10957 | { | ||
| 10958 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217928 times.
|
217928 | if(switch_hooked) return enemy::animate(index); |
| 10959 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 217928 times.
|
217928 | if(dying) |
| 10960 | ✗ | return Dead(index); | |
| 10961 | |||
| 10962 | //if(clk>32) | ||
| 10963 | 217928 | misc=1; | |
| 10964 | 217928 | bool w=watch; | |
| 10965 | 217928 | watch=false; | |
| 10966 | 217928 | variable_walk_8(misc?3:0,0,8,spw_floater); | |
| 10967 | 217928 | watch=w; | |
| 10968 | |||
| 10969 |
2/2✓ Branch 0 taken 1052 times.
✓ Branch 1 taken 216876 times.
|
217928 | if(clk==0) |
| 10970 | { | ||
| 10971 | 1052 | removearmos(x,y,ffcactivated); | |
| 10972 | 1052 | } | |
| 10973 | |||
| 10974 | 217928 | return enemy::animate(index); | |
| 10975 | 217928 | } | |
| 10976 | |||
| 10977 | 437012 | void eItemFairy::draw(BITMAP *dest) | |
| 10978 | { | ||
| 10979 | //these are here to bypass compiler warnings about unused arguments | ||
| 10980 | 437012 | dest=dest; | |
| 10981 | 437012 | } | |
| 10982 | |||
| 10983 | 1730 | ePeahat::ePeahat(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 10984 | 1730 | { | |
| 10985 | //floater_walk(int32_t rate,int32_t newclk,zfix ms,zfix ss,int32_t s,int32_t p, int32_t g) | ||
| 10986 |
10/20✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✓ Branch 2 taken 865 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 865 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 865 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 865 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 865 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 865 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 865 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 865 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 865 times.
✗ Branch 19 not taken.
|
865 | floater_walk(misc?rate:0, hrate, zslongToFix(dstep*100),zslongToFix(dstep*10), 10, dmisc16,dmisc17); // 80, 16); |
| 10987 | 865 | dir=8; | |
| 10988 | 865 | movestatus=1; | |
| 10989 | 865 | clk=0; | |
| 10990 |
1/2✓ Branch 0 taken 865 times.
✗ Branch 1 not taken.
|
865 | step=0; |
| 10991 | //nets+720; | ||
| 10992 | 865 | SIZEflags = d->SIZEflags; | |
| 10993 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
865 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 10994 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 10995 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 10996 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
865 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 10997 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
865 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 10998 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
865 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 10999 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
865 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 11000 |
1/2✓ Branch 0 taken 865 times.
✗ Branch 1 not taken.
|
865 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 11001 |
1/2✓ Branch 0 taken 865 times.
✗ Branch 1 not taken.
|
865 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 11002 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 11003 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
865 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 11004 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
|
865 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 11005 | { | ||
| 11006 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 11007 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 11008 | ✗ | } | |
| 11009 | |||
| 11010 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 865 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
865 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 11011 | 865 | } | |
| 11012 | |||
| 11013 | 262180 | bool ePeahat::animate(int32_t index) | |
| 11014 | { | ||
| 11015 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 262180 times.
|
262180 | if(switch_hooked) return enemy::animate(index); |
| 11016 |
2/4✓ Branch 0 taken 262180 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 262180 times.
|
262180 | if(fallclk||drownclk) return enemy::animate(index); |
| 11017 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 262102 times.
|
262180 | if(slide()) |
| 11018 | { | ||
| 11019 | 78 | return false; | |
| 11020 | } | ||
| 11021 | |||
| 11022 |
2/2✓ Branch 0 taken 486 times.
✓ Branch 1 taken 261616 times.
|
262102 | if(dying) |
| 11023 | 486 | return Dead(index); | |
| 11024 | |||
| 11025 |
2/2✓ Branch 0 taken 260042 times.
✓ Branch 1 taken 1574 times.
|
261616 | if(clk==0) |
| 11026 | { | ||
| 11027 | 1574 | removearmos(x,y,ffcactivated); | |
| 11028 | 1574 | } | |
| 11029 | |||
| 11030 |
4/4✓ Branch 0 taken 258836 times.
✓ Branch 1 taken 2780 times.
✓ Branch 2 taken 123988 times.
✓ Branch 3 taken 134848 times.
|
261616 | if(stunclk==0 && clk>96) |
| 11031 | 134848 | misc=1; | |
| 11032 | |||
| 11033 |
2/2✓ Branch 0 taken 2402 times.
✓ Branch 1 taken 259214 times.
|
261616 | if(!watch) |
| 11034 |
2/2✓ Branch 0 taken 174832 times.
✓ Branch 1 taken 84382 times.
|
259214 | floater_walk(misc?rate:0, hrate, zslongToFix(dstep*100),zslongToFix(dstep*10), 10, 80, 16); |
| 11035 | |||
| 11036 |
3/4✓ Branch 0 taken 100018 times.
✓ Branch 1 taken 161598 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 100018 times.
|
261616 | if(get_bit(quest_rules,qr_ENEMIESZAXIS) && !(isSideViewGravity())) |
| 11037 | { | ||
| 11038 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100018 times.
|
100018 | if (moveflags & FLAG_USE_FAKE_Z) fakez=int32_t(step*1.1/((zslongToFix(dstep*10))*1.1)); |
| 11039 | 100018 | else z=int32_t(step*1.1/((zslongToFix(dstep*10))*1.1)); | |
| 11040 | 100018 | } | |
| 11041 | |||
| 11042 |
4/4✓ Branch 0 taken 2402 times.
✓ Branch 1 taken 259214 times.
✓ Branch 2 taken 1634 times.
✓ Branch 3 taken 768 times.
|
261616 | if(watch && get_bit(quest_rules,qr_PEAHATCLOCKVULN)) |
| 11043 | 1634 | superman=0; | |
| 11044 | else | ||
| 11045 |
2/2✓ Branch 0 taken 253338 times.
✓ Branch 1 taken 6644 times.
|
259982 | superman=(movestatus && !get_bit(quest_rules,qr_ENEMIESZAXIS)) ? 1 : 0; |
| 11046 | //stunclk=0; //Not sure what was going on here, or what was intended. Why was this set to 0? -Z | ||
| 11047 |
2/2✓ Branch 0 taken 196019 times.
✓ Branch 1 taken 65597 times.
|
261616 | if ( FFCore.getQuestHeaderInfo(vZelda) >= 0x250 ) |
| 11048 | { | ||
| 11049 |
2/2✓ Branch 0 taken 2777 times.
✓ Branch 1 taken 193242 times.
|
196019 | if ( stunclk ) --stunclk; |
| 11050 | 196019 | } | |
| 11051 | 65597 | else stunclk = 0; //Was probably this way in 2.10 quests. if not, then we never need to clear it. -Z | |
| 11052 | //Pretty sure this was always an error. -Z ( 14FEB2019 ) | ||
| 11053 | |||
| 11054 | |||
| 11055 |
2/2✓ Branch 0 taken 222 times.
✓ Branch 1 taken 261394 times.
|
261616 | if(x<16) dir=right; //this is ugly, but so is moving or creating these guys with scripts. |
| 11056 | |||
| 11057 | 261616 | return enemy::animate(index); | |
| 11058 | 262180 | } | |
| 11059 | |||
| 11060 | 88089 | void ePeahat::drawshadow(BITMAP *dest, bool translucent) | |
| 11061 | { | ||
| 11062 | 88089 | int32_t tempy=yofs; | |
| 11063 | 88089 | flip = 0; | |
| 11064 | 88089 | shadowtile = wpnsbuf[spr_shadow].tile+posframe; | |
| 11065 | |||
| 11066 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88089 times.
|
88089 | if(!get_bit(quest_rules,qr_ENEMIESZAXIS)) |
| 11067 | { | ||
| 11068 | ✗ | yofs+=8; | |
| 11069 | ✗ | yofs+=int32_t(step/zslongToFix(dstep*10)); | |
| 11070 | ✗ | } | |
| 11071 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88089 times.
|
88089 | if(!shadow_overpit(this)) |
| 11072 | 88089 | enemy::drawshadow(dest,translucent); | |
| 11073 | 88089 | yofs=tempy; | |
| 11074 | 88089 | } | |
| 11075 | |||
| 11076 | 618206 | void ePeahat::draw(BITMAP *dest) | |
| 11077 | { | ||
| 11078 | 618206 | update_enemy_frame(); | |
| 11079 | 618206 | enemy::draw(dest); | |
| 11080 | 618206 | } | |
| 11081 | |||
| 11082 | 930 | int32_t ePeahat::takehit(weapon *w, weapon* realweap) | |
| 11083 | { | ||
| 11084 | 930 | int32_t wpnId = w->id; | |
| 11085 | 930 | int32_t enemyHitWeapon = w->parentitem; | |
| 11086 | |||
| 11087 |
3/6✓ Branch 0 taken 930 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 930 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 930 times.
|
930 | if(dying || clk<0 || hclk>0) |
| 11088 | ✗ | return 0; | |
| 11089 | |||
| 11090 |
4/4✓ Branch 0 taken 736 times.
✓ Branch 1 taken 194 times.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 102 times.
|
1062 | if(superman && !(wpnId==wSBomb) // vulnerable to super bombs |
| 11091 | // fire boomerang, for nailing peahats | ||
| 11092 |
4/6✓ Branch 0 taken 736 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 604 times.
✓ Branch 3 taken 132 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 132 times.
|
736 | && !(wpnId==wBrang && (enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_brang))>0)) |
| 11093 | 706 | return 0; | |
| 11094 | |||
| 11095 | // Time for a kludge... | ||
| 11096 | 224 | int32_t s = superman; | |
| 11097 | 224 | superman = 0; | |
| 11098 | 224 | int32_t ret = enemy::takehit(w,realweap); | |
| 11099 | 224 | superman = s; | |
| 11100 | |||
| 11101 | // Anyway... | ||
| 11102 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 141 times.
|
224 | if(stunclk == 160) |
| 11103 | { | ||
| 11104 | 141 | clk2=0; | |
| 11105 | 141 | movestatus=0; | |
| 11106 | 141 | misc=0; | |
| 11107 | 141 | clk=0; | |
| 11108 | 141 | step=0; | |
| 11109 | 141 | } | |
| 11110 | |||
| 11111 | 224 | return ret; | |
| 11112 | 930 | } | |
| 11113 | |||
| 11114 | // auomatically kill off enemy (for rooms with ringleaders) | ||
| 11115 | ✗ | void ePeahat::kickbucket() | |
| 11116 | { | ||
| 11117 | ✗ | hp=-1000; // don't call death_sfx() | |
| 11118 | ✗ | } | |
| 11119 | |||
| 11120 | 3388 | eLeever::eLeever(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 11121 | 3388 | { | |
| 11122 | // if(d->misc1==0) { misc=-1; clk-=16; } //Line of Sight leevers | ||
| 11123 |
2/2✓ Branch 0 taken 753 times.
✓ Branch 1 taken 941 times.
|
1694 | if(dmisc1==0) |
| 11124 | { | ||
| 11125 | 941 | misc=-1; //Line of Sight leevers | |
| 11126 | 941 | clk-=16; | |
| 11127 | 941 | } | |
| 11128 | 1694 | clk3 = 0; | |
| 11129 | //nets+1460; | ||
| 11130 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | temprule=(get_bit(quest_rules,qr_NEWENEMYTILES)) != 0; |
| 11131 | 1694 | submerged = false; | |
| 11132 | 1694 | SIZEflags = d->SIZEflags; | |
| 11133 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1694 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 11134 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 11135 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 11136 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1694 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 11137 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1694 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 11138 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1694 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 11139 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1694 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 11140 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 11141 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 11142 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 11143 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1694 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 11144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
|
1694 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 11145 | { | ||
| 11146 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 11147 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 11148 | ✗ | } | |
| 11149 | |||
| 11150 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1694 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1694 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 11151 | 1694 | } | |
| 11152 | |||
| 11153 | ✗ | bool eLeever::isSubmerged() const | |
| 11154 | { | ||
| 11155 | ✗ | Z_scripterrlog("misc is: %d\n", misc); | |
| 11156 | ✗ | return misc <= 0; | |
| 11157 | |||
| 11158 | } | ||
| 11159 | |||
| 11160 | 499943 | bool eLeever::animate(int32_t index) | |
| 11161 | { | ||
| 11162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 499943 times.
|
499943 | if(switch_hooked) return enemy::animate(index); |
| 11163 |
2/4✓ Branch 0 taken 499943 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 499943 times.
|
499943 | if(fallclk||drownclk) |
| 11164 | { | ||
| 11165 | ✗ | return enemy::animate(index); | |
| 11166 | } | ||
| 11167 |
2/2✓ Branch 0 taken 16506 times.
✓ Branch 1 taken 483437 times.
|
499943 | if(dying) |
| 11168 | 16506 | return Dead(index); | |
| 11169 | |||
| 11170 |
2/2✓ Branch 0 taken 463097 times.
✓ Branch 1 taken 20340 times.
|
483437 | if(clk==0) |
| 11171 | { | ||
| 11172 | 20340 | removearmos(x,y,ffcactivated); | |
| 11173 | 20340 | } | |
| 11174 | |||
| 11175 |
4/4✓ Branch 0 taken 393192 times.
✓ Branch 1 taken 90245 times.
✓ Branch 2 taken 2529 times.
✓ Branch 3 taken 390663 times.
|
483437 | if(clk>=0 && !slide()) |
| 11176 | { | ||
| 11177 | // switch(d->misc1) | ||
| 11178 |
2/2✓ Branch 0 taken 156396 times.
✓ Branch 1 taken 234267 times.
|
390663 | switch(dmisc1) |
| 11179 | { | ||
| 11180 | case 0: //line of sight | ||
| 11181 | case 2: | ||
| 11182 |
7/8✗ Branch 0 not taken.
✓ Branch 1 taken 67550 times.
✓ Branch 2 taken 17136 times.
✓ Branch 3 taken 15898 times.
✓ Branch 4 taken 7088 times.
✓ Branch 5 taken 43977 times.
✓ Branch 6 taken 1832 times.
✓ Branch 7 taken 2915 times.
|
156396 | switch(misc) //is this leever active |
| 11183 | { | ||
| 11184 | case -1: //submerged | ||
| 11185 | { | ||
| 11186 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 67550 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
67550 | if (!get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) && (watch || stunclk)) misc = 0; |
| 11187 |
4/4✓ Branch 0 taken 7609 times.
✓ Branch 1 taken 59941 times.
✓ Branch 2 taken 7582 times.
✓ Branch 3 taken 27 times.
|
67550 | if((dmisc1==2)&&(zc_oldrand()&255)) |
| 11188 | { | ||
| 11189 | 7582 | break; | |
| 11190 | } | ||
| 11191 | |||
| 11192 | 59968 | int32_t active=0; | |
| 11193 | |||
| 11194 |
2/2✓ Branch 0 taken 424896 times.
✓ Branch 1 taken 59968 times.
|
484864 | for(int32_t i=0; i<guys.Count(); i++) |
| 11195 | { | ||
| 11196 |
4/4✓ Branch 0 taken 348604 times.
✓ Branch 1 taken 76292 times.
✓ Branch 2 taken 229810 times.
✓ Branch 3 taken 118794 times.
|
424896 | if(guys.spr(i)->id==id && (((enemy*)guys.spr(i))->misc>=0)) |
| 11197 | { | ||
| 11198 | 118794 | ++active; | |
| 11199 | 118794 | } | |
| 11200 | 424896 | } | |
| 11201 | |||
| 11202 |
2/2✓ Branch 0 taken 59147 times.
✓ Branch 1 taken 821 times.
|
59968 | if(active<((dmisc1==2)?1:2)) |
| 11203 | { | ||
| 11204 | 821 | misc=0; //activate this one | |
| 11205 | 821 | clk3=1; //This needs to be set so that it knows that it's being emerged of it's own will and not because it got stunned. | |
| 11206 | 821 | } | |
| 11207 | } | ||
| 11208 | 59968 | break; | |
| 11209 | |||
| 11210 | case 0: | ||
| 11211 | { | ||
| 11212 | |||
| 11213 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17136 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17136 | if (!get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) && (watch || stunclk)) |
| 11214 | { | ||
| 11215 | ✗ | misc=1; | |
| 11216 | ✗ | clk2=0; | |
| 11217 | ✗ | } | |
| 11218 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 17100 times.
|
17136 | else if (clk3<=0) |
| 11219 | { | ||
| 11220 | 36 | misc = -1; | |
| 11221 | 36 | break; | |
| 11222 | } | ||
| 11223 | 17100 | int32_t s=0; | |
| 11224 | |||
| 11225 |
2/2✓ Branch 0 taken 112208 times.
✓ Branch 1 taken 17100 times.
|
129308 | for(int32_t i=0; i<guys.Count(); i++) |
| 11226 | { | ||
| 11227 |
4/4✓ Branch 0 taken 74011 times.
✓ Branch 1 taken 38197 times.
✓ Branch 2 taken 71849 times.
✓ Branch 3 taken 2162 times.
|
112208 | if(guys.spr(i)->id==id && ((enemy*)guys.spr(i))->misc==1) |
| 11228 | { | ||
| 11229 | 2162 | ++s; | |
| 11230 | 2162 | } | |
| 11231 | 112208 | } | |
| 11232 | |||
| 11233 |
2/2✓ Branch 0 taken 2162 times.
✓ Branch 1 taken 14938 times.
|
17100 | if(s>0) |
| 11234 | { | ||
| 11235 | 2162 | break; | |
| 11236 | } | ||
| 11237 | |||
| 11238 | 14938 | int32_t d2=zc_oldrand()&1; | |
| 11239 | |||
| 11240 |
2/2✓ Branch 0 taken 5336 times.
✓ Branch 1 taken 9602 times.
|
14938 | if(HeroDir()>=left) |
| 11241 | { | ||
| 11242 | 9602 | d2+=2; | |
| 11243 | 9602 | } | |
| 11244 | |||
| 11245 |
4/4✓ Branch 0 taken 14295 times.
✓ Branch 1 taken 643 times.
✓ Branch 2 taken 300 times.
✓ Branch 3 taken 13995 times.
|
14938 | if(canplace(d2) || canplace(d2^1)) |
| 11246 | { | ||
| 11247 | 943 | misc=1; | |
| 11248 | 943 | clk2=0; | |
| 11249 | 943 | clk=0; | |
| 11250 | 943 | } | |
| 11251 | } | ||
| 11252 | 14938 | break; | |
| 11253 | |||
| 11254 | case 1: | ||
| 11255 | |||
| 11256 |
3/8✓ Branch 0 taken 14970 times.
✓ Branch 1 taken 928 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14970 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
15898 | if(++clk2>16||(!get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) && (watch || stunclk) && clk2>8)) misc=2; |
| 11257 | |||
| 11258 | 15898 | break; | |
| 11259 | |||
| 11260 | case 2: | ||
| 11261 | |||
| 11262 |
3/8✓ Branch 0 taken 6227 times.
✓ Branch 1 taken 861 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6227 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
7088 | if(++clk2>24||(!get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) && (watch || stunclk) && clk2>12)) misc=3; |
| 11263 | |||
| 11264 | 7088 | break; | |
| 11265 | |||
| 11266 | // case 3: if(stunclk) break; if(scored) dir^=1; if(!canmove(dir,false)) misc=4; else move((zfix)(d->step/100.0)); break; | ||
| 11267 | case 3: | ||
| 11268 | |||
| 11269 |
5/6✓ Branch 0 taken 41679 times.
✓ Branch 1 taken 2298 times.
✓ Branch 2 taken 41679 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2066 times.
✓ Branch 5 taken 39613 times.
|
43977 | if(stunclk || frozenclock || watch) break; |
| 11270 | |||
| 11271 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 39534 times.
|
39613 | if(scored) dir^=1; |
| 11272 | |||
| 11273 |
2/2✓ Branch 0 taken 211 times.
✓ Branch 1 taken 39402 times.
|
39613 | if(!canmove(dir,false)) misc=4; |
| 11274 | 39402 | else move(zslongToFix(dstep*100)); | |
| 11275 | |||
| 11276 | 39613 | break; | |
| 11277 | |||
| 11278 | case 4: | ||
| 11279 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1832 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1832 | if (!get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) && (watch || stunclk)) misc = 2; |
| 11280 |
2/2✓ Branch 0 taken 1635 times.
✓ Branch 1 taken 197 times.
|
1832 | if(--clk2<=16) |
| 11281 | { | ||
| 11282 | 197 | misc=5; | |
| 11283 | 197 | clk=8; | |
| 11284 | 197 | } | |
| 11285 | |||
| 11286 | 1832 | break; | |
| 11287 | |||
| 11288 | case 5: | ||
| 11289 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2915 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2915 | if (!get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) && (watch || stunclk)) misc = 1; |
| 11290 |
2/2✓ Branch 0 taken 2740 times.
✓ Branch 1 taken 175 times.
|
2915 | if(--clk2<=0) misc=((dmisc1==2)?-1:0); |
| 11291 | |||
| 11292 | 2915 | break; | |
| 11293 | } // switch(misc) | ||
| 11294 | |||
| 11295 | 156396 | break; | |
| 11296 | |||
| 11297 | default: //random | ||
| 11298 | // step=d->misc3/100.0; | ||
| 11299 | |||
| 11300 | 234267 | step=zslongToFix(dmisc3*100); | |
| 11301 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 234267 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
234267 | if (get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) || (!watch && !stunclk)) ++clk2; |
| 11302 | ✗ | else if (!get_bit(quest_rules, qr_LEEVERS_DONT_OBEY_STUN) && (watch || stunclk)) | |
| 11303 | { | ||
| 11304 | ✗ | if (clk2 < 48) clk2+=2; | |
| 11305 | ✗ | if (clk2 >= 300) clk2-=2; | |
| 11306 | ✗ | } | |
| 11307 | |||
| 11308 |
2/2✓ Branch 0 taken 27519 times.
✓ Branch 1 taken 206748 times.
|
234267 | if(clk2<32) misc=1; |
| 11309 |
2/2✓ Branch 0 taken 13816 times.
✓ Branch 1 taken 192932 times.
|
206748 | else if(clk2<48) misc=2; |
| 11310 |
2/2✓ Branch 0 taken 140831 times.
✓ Branch 1 taken 52101 times.
|
192932 | else if(clk2<300) |
| 11311 | { | ||
| 11312 | /*if(misc==2 && (int32_t)(dmisc3*0.48)%8) | ||
| 11313 | { | ||
| 11314 | fix_coords(); | ||
| 11315 | }*/ | ||
| 11316 | 140831 | misc=3; | |
| 11317 | 140831 | step = zslongToFix(dstep*100); | |
| 11318 | 140831 | } | |
| 11319 |
2/2✓ Branch 0 taken 4801 times.
✓ Branch 1 taken 47300 times.
|
52101 | else if(clk2<316) misc=2; |
| 11320 |
2/2✓ Branch 0 taken 23641 times.
✓ Branch 1 taken 23659 times.
|
47300 | else if(clk2<412) misc=1; |
| 11321 |
2/2✓ Branch 0 taken 23490 times.
✓ Branch 1 taken 169 times.
|
23659 | else if(clk2<540) |
| 11322 | { | ||
| 11323 | 23490 | misc=0; | |
| 11324 | 23490 | step=0; | |
| 11325 | 23490 | } | |
| 11326 | 169 | else clk2=0; | |
| 11327 | |||
| 11328 |
2/2✓ Branch 0 taken 233418 times.
✓ Branch 1 taken 849 times.
|
234267 | if(clk2==48) clk=0; |
| 11329 | |||
| 11330 | // variable_walk(d->rate, d->homing, 0); | ||
| 11331 | 234267 | variable_walk(rate, homing, 0); | |
| 11332 | 234267 | } // switch(dmisc1) | |
| 11333 | 390663 | } | |
| 11334 | |||
| 11335 | 483437 | hxofs=(misc>=2)?0:1000; | |
| 11336 | 483437 | return enemy::animate(index); | |
| 11337 | 499943 | } | |
| 11338 | |||
| 11339 | 29233 | bool eLeever::canplace(int32_t d2) | |
| 11340 | { | ||
| 11341 | 29233 | int32_t nx=HeroX(); | |
| 11342 | 29233 | int32_t ny=HeroY(); | |
| 11343 | |||
| 11344 |
2/2✓ Branch 0 taken 10404 times.
✓ Branch 1 taken 18829 times.
|
29233 | if(d2<left) ny&=0xF0; |
| 11345 | 18829 | else nx&=0xF0; | |
| 11346 | |||
| 11347 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 5173 times.
✓ Branch 2 taken 5231 times.
✓ Branch 3 taken 9395 times.
✓ Branch 4 taken 9434 times.
|
29233 | switch(d2) |
| 11348 | { | ||
| 11349 | // case up: ny-=((d->misc1==0)?32:48); break; | ||
| 11350 | // case down: ny+=((d->misc1==0)?32:48); if(ny-HeroY()<32) ny+=((d->misc1==0)?16:0); break; | ||
| 11351 | // case left: nx-=((d->misc1==0)?32:48); break; | ||
| 11352 | // case right: nx+=((d->misc1==0)?32:48); if(nx-HeroX()<32) nx+=((d->misc1==0)?16:0); break; | ||
| 11353 | case up: | ||
| 11354 |
2/2✓ Branch 0 taken 5145 times.
✓ Branch 1 taken 28 times.
|
5173 | ny-=((dmisc1==0||dmisc1==2)?32:48); |
| 11355 | 5173 | break; | |
| 11356 | |||
| 11357 | case down: | ||
| 11358 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 5200 times.
|
5231 | ny+=((dmisc1==0||dmisc1==2)?32:48); |
| 11359 | |||
| 11360 |
4/4✓ Branch 0 taken 2757 times.
✓ Branch 1 taken 2474 times.
✓ Branch 2 taken 2748 times.
✓ Branch 3 taken 9 times.
|
5231 | if(ny-HeroY()<32) ny+=((dmisc1==0||dmisc1==2)?16:0); |
| 11361 | |||
| 11362 | 5231 | break; | |
| 11363 | |||
| 11364 | case left: | ||
| 11365 |
2/2✓ Branch 0 taken 8795 times.
✓ Branch 1 taken 600 times.
|
9395 | nx-=((dmisc1==0||dmisc1==2)?32:48); |
| 11366 | 9395 | break; | |
| 11367 | |||
| 11368 | case right: | ||
| 11369 |
2/2✓ Branch 0 taken 595 times.
✓ Branch 1 taken 8839 times.
|
9434 | nx+=((dmisc1==0||dmisc1==2)?32:48); |
| 11370 | |||
| 11371 |
4/4✓ Branch 0 taken 6054 times.
✓ Branch 1 taken 3380 times.
✓ Branch 2 taken 5499 times.
✓ Branch 3 taken 555 times.
|
9434 | if(nx-HeroX()<32) nx+=((dmisc1==0||dmisc1==2)?16:0); |
| 11372 | |||
| 11373 | 9434 | break; | |
| 11374 | } | ||
| 11375 | |||
| 11376 |
4/4✓ Branch 0 taken 10020 times.
✓ Branch 1 taken 19213 times.
✓ Branch 2 taken 4483 times.
✓ Branch 3 taken 5537 times.
|
29233 | if(m_walkflag(nx,ny,spw_halfstep, dir)||m_walkflag(nx,ny-8,spw_halfstep, dir)) /*none*/ |
| 11377 | 23696 | return false; | |
| 11378 | |||
| 11379 |
2/2✓ Branch 0 taken 439 times.
✓ Branch 1 taken 5098 times.
|
5537 | if(d2>=left) |
| 11380 |
4/4✓ Branch 0 taken 2481 times.
✓ Branch 1 taken 2617 times.
✓ Branch 2 taken 4594 times.
✓ Branch 3 taken 504 times.
|
5098 | if(m_walkflag(HeroX(),HeroY(),spw_halfstep, dir)||m_walkflag(HeroX(),HeroY()-8,spw_halfstep, dir)) /*none*/ |
| 11381 | 4594 | return false; | |
| 11382 | |||
| 11383 | 943 | x=nx; | |
| 11384 | 943 | y=ny; | |
| 11385 | 943 | dir=d2^1; | |
| 11386 | 943 | return true; | |
| 11387 | 29233 | } | |
| 11388 | |||
| 11389 | 500779 | void eLeever::draw(BITMAP *dest) | |
| 11390 | { | ||
| 11391 | // cs=d->cset; | ||
| 11392 | 500779 | cs=dcset; | |
| 11393 | 500779 | update_enemy_frame(); | |
| 11394 |
2/4✓ Branch 0 taken 500779 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 500779 times.
|
500779 | if(!fallclk&&!drownclk) |
| 11395 | { | ||
| 11396 |
2/2✓ Branch 0 taken 301145 times.
✓ Branch 1 taken 199634 times.
|
500779 | switch(misc) |
| 11397 | { | ||
| 11398 | case -1: | ||
| 11399 | case 0: | ||
| 11400 | 199634 | return; | |
| 11401 | } | ||
| 11402 | 301145 | } | |
| 11403 | |||
| 11404 | 301145 | enemy::draw(dest); | |
| 11405 | 500779 | } | |
| 11406 | |||
| 11407 | 938 | eWallM::eWallM(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 11408 | 938 | { | |
| 11409 | //zprint2("eWallM::eWallM\n"); | ||
| 11410 | 469 | hashero=false; | |
| 11411 | //nets+1000; | ||
| 11412 | 469 | SIZEflags = d->SIZEflags; | |
| 11413 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
469 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 11414 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 11415 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 11416 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
469 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 11417 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
469 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 11418 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
469 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 11419 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
469 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 11420 |
1/2✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
|
469 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 11421 |
1/2✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
|
469 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 11422 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 11423 |
1/4✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
469 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 11424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 469 times.
|
469 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 11425 | { | ||
| 11426 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 11427 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 11428 | ✗ | } | |
| 11429 | |||
| 11430 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
469 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 11431 | 469 | } | |
| 11432 | |||
| 11433 | 296039 | bool eWallM::animate(int32_t index) | |
| 11434 | { | ||
| 11435 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 296039 times.
|
296039 | if(switch_hooked) return enemy::animate(index); |
| 11436 |
2/4✓ Branch 0 taken 296039 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 296039 times.
|
296039 | if(fallclk||drownclk) |
| 11437 | { | ||
| 11438 | ✗ | return enemy::animate(index); | |
| 11439 | } | ||
| 11440 |
2/2✓ Branch 0 taken 5862 times.
✓ Branch 1 taken 290177 times.
|
296039 | if(dying) |
| 11441 | 5862 | return Dead(index); | |
| 11442 | |||
| 11443 |
2/2✓ Branch 0 taken 271686 times.
✓ Branch 1 taken 18491 times.
|
290177 | if(clk==0) |
| 11444 | { | ||
| 11445 | 18491 | removearmos(x,y,ffcactivated); | |
| 11446 | 18491 | } | |
| 11447 | |||
| 11448 | 290177 | hxofs=1000; | |
| 11449 |
2/2✓ Branch 0 taken 74303 times.
✓ Branch 1 taken 215874 times.
|
290177 | if(misc==0) //inside wall, ready to spawn? |
| 11450 | { | ||
| 11451 | //zprint2("Wallmaster is ready to spawn, clk is: %d\n",clk); | ||
| 11452 | //zprint2("frame is: %d\n",frame); | ||
| 11453 | //zprint2("wallm_load_clk is: %d\n",wallm_load_clk); | ||
| 11454 |
4/4✓ Branch 0 taken 143051 times.
✓ Branch 1 taken 72823 times.
✓ Branch 2 taken 8214 times.
✓ Branch 3 taken 134837 times.
|
215874 | if(frame-wallm_load_clk>80 && clk>=0) |
| 11455 | { | ||
| 11456 | //zprint2("getting wall\n"); | ||
| 11457 | 134837 | int32_t wall=hero_on_wall(); | |
| 11458 | //zprint2("Wallmaster wall is %d\n",wall); | ||
| 11459 | 134837 | int32_t wallm_cnt=0; | |
| 11460 | |||
| 11461 |
2/2✓ Branch 0 taken 1046303 times.
✓ Branch 1 taken 134837 times.
|
1181140 | for(int32_t i=0; i<guys.Count(); i++) |
| 11462 |
2/2✓ Branch 0 taken 399790 times.
✓ Branch 1 taken 646513 times.
|
1692816 | if(((enemy*)guys.spr(i))->family==eeWALLM) |
| 11463 | { | ||
| 11464 | 646513 | int32_t m=((enemy*)guys.spr(i))->misc; | |
| 11465 | |||
| 11466 |
4/4✓ Branch 0 taken 29106 times.
✓ Branch 1 taken 617407 times.
✓ Branch 2 taken 17904 times.
✓ Branch 3 taken 11202 times.
|
646513 | if(m && ((enemy*)guys.spr(i))->clk3==(wall^1)) |
| 11467 | { | ||
| 11468 | 11202 | ++wallm_cnt; | |
| 11469 | 11202 | } | |
| 11470 | 646513 | } | |
| 11471 | |||
| 11472 |
2/2✓ Branch 0 taken 134373 times.
✓ Branch 1 taken 464 times.
|
134837 | if(wall>0) |
| 11473 | { | ||
| 11474 | 464 | --wall; | |
| 11475 | 464 | misc=1; //emerging from the wall? | |
| 11476 | //zprint2("Wallmaster is emerging\n"); | ||
| 11477 | 464 | clk2=0; | |
| 11478 | 464 | clk3=wall^1; | |
| 11479 | 464 | wallm_load_clk=frame; | |
| 11480 | |||
| 11481 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 188 times.
|
464 | if(wall<=down) |
| 11482 | { | ||
| 11483 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 228 times.
|
276 | if(HeroDir()==left) |
| 11484 | 48 | dir=right; | |
| 11485 | else | ||
| 11486 | 228 | dir=left; | |
| 11487 | 276 | } | |
| 11488 | else | ||
| 11489 | { | ||
| 11490 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 150 times.
|
188 | if(HeroDir()==up) |
| 11491 | 38 | dir=down; | |
| 11492 | else | ||
| 11493 | 150 | dir=up; | |
| 11494 | } | ||
| 11495 | |||
| 11496 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 146 times.
✓ Branch 2 taken 130 times.
✓ Branch 3 taken 128 times.
✓ Branch 4 taken 60 times.
|
464 | switch(wall) |
| 11497 | { | ||
| 11498 | case up: | ||
| 11499 | 146 | y=0; | |
| 11500 | 146 | break; | |
| 11501 | |||
| 11502 | case down: | ||
| 11503 | 130 | y=160; | |
| 11504 | 130 | break; | |
| 11505 | |||
| 11506 | case left: | ||
| 11507 | 128 | x=0; | |
| 11508 | 128 | break; | |
| 11509 | |||
| 11510 | case right: | ||
| 11511 | 60 | x=240; | |
| 11512 | 60 | break; | |
| 11513 | } | ||
| 11514 | |||
| 11515 | //zprint2("Wallmaster (p1) x is %d\n",x); | ||
| 11516 | //zprint2("Wallmaster (p1) y is %d\n",y); | ||
| 11517 | |||
| 11518 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 150 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 228 times.
✓ Branch 4 taken 48 times.
|
464 | switch(dir) |
| 11519 | { | ||
| 11520 | case up: | ||
| 11521 | 150 | y=(HeroY()+48-(wallm_cnt&1)*12); | |
| 11522 | 150 | flip=wall&1; | |
| 11523 | 150 | break; | |
| 11524 | |||
| 11525 | case down: | ||
| 11526 | 38 | y=(HeroY()-48+(wallm_cnt&1)*12); | |
| 11527 | 38 | flip=((wall&1)^1)+2; | |
| 11528 | 38 | break; | |
| 11529 | |||
| 11530 | case left: | ||
| 11531 | 228 | x=(HeroX()+48-(wallm_cnt&1)*12); | |
| 11532 | 228 | flip=(wall==up?2:0)+1; | |
| 11533 | 228 | break; | |
| 11534 | |||
| 11535 | case right: | ||
| 11536 | 48 | x=(HeroX()-48+(wallm_cnt&1)*12); | |
| 11537 | 48 | flip=(wall==up?2:0); | |
| 11538 | 48 | break; | |
| 11539 | } | ||
| 11540 | |||
| 11541 | //zprint2("Wallmaster (p2) x is %d\n",x); | ||
| 11542 | //zprint2("Wallmaster (p2) y is %d\n",y); | ||
| 11543 | 464 | } | |
| 11544 | 134837 | } | |
| 11545 | 215874 | } | |
| 11546 | else | ||
| 11547 | 74303 | wallm_crawl(); | |
| 11548 | |||
| 11549 | 290177 | return enemy::animate(index); | |
| 11550 | 296039 | } | |
| 11551 | |||
| 11552 | 74303 | void eWallM::wallm_crawl() | |
| 11553 | { | ||
| 11554 | 74303 | bool w=watch; | |
| 11555 | 74303 | hxofs=0; | |
| 11556 | |||
| 11557 |
2/2✓ Branch 0 taken 476 times.
✓ Branch 1 taken 73827 times.
|
74303 | if(slide()) |
| 11558 | { | ||
| 11559 | 476 | return; | |
| 11560 | } | ||
| 11561 | |||
| 11562 | // if(dying || watch || (!hashero && stunclk)) | ||
| 11563 |
6/8✓ Branch 0 taken 73827 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73538 times.
✓ Branch 3 taken 289 times.
✓ Branch 4 taken 59860 times.
✓ Branch 5 taken 13678 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 59860 times.
|
73827 | if(dying || (!hashero && ( stunclk || frozenclock ))) |
| 11564 | { | ||
| 11565 | 13678 | return; | |
| 11566 | } | ||
| 11567 | |||
| 11568 | 60149 | watch=false; | |
| 11569 | 60149 | ++clk2; | |
| 11570 | // Misc1: slightly different movement | ||
| 11571 | //zprint2("wallmaster crawl\n"); | ||
| 11572 | //zprint2("wallmaster tmpdstep is %d\n",tmpdstep); | ||
| 11573 | 60149 | float tmpmisc3 = ((40.0/(int32_t)dstep)*40); | |
| 11574 | |||
| 11575 | //int32_t tmpmisc = int32_t((40.0/dstep)*40); | ||
| 11576 | //zprint2("wallmaster crawl tmpmisc is: %d\n", tmpmisc); | ||
| 11577 | //zprint2("wallmaster crawl tmpmisc4 is: %d\n", tmpmisc4); | ||
| 11578 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60149 times.
|
60149 | misc=(clk2/(dmisc1==1?40:(int32_t)tmpmisc3))+1; |
| 11579 | //zprint2("wallmaster crawl misc is: %d\n", misc); | ||
| 11580 |
5/6✓ Branch 0 taken 5628 times.
✓ Branch 1 taken 54521 times.
✓ Branch 2 taken 4388 times.
✓ Branch 3 taken 1240 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4388 times.
|
60149 | if(w&&misc>=3&&misc<=5) |
| 11581 | { | ||
| 11582 | 4388 | --clk2; | |
| 11583 | 4388 | } | |
| 11584 | |||
| 11585 |
4/4✓ Branch 0 taken 25651 times.
✓ Branch 1 taken 27926 times.
✓ Branch 2 taken 6468 times.
✓ Branch 3 taken 104 times.
|
60149 | switch(misc) |
| 11586 | { | ||
| 11587 | case 1: | ||
| 11588 | case 2: | ||
| 11589 | 27926 | zc_swap(dir,clk3); | |
| 11590 | 27926 | move(step); | |
| 11591 | 27926 | zc_swap(dir,clk3); | |
| 11592 | 27926 | break; | |
| 11593 | |||
| 11594 | case 3: | ||
| 11595 | case 4: | ||
| 11596 | case 5: | ||
| 11597 |
2/2✓ Branch 0 taken 4388 times.
✓ Branch 1 taken 21263 times.
|
25651 | if(w) |
| 11598 | { | ||
| 11599 | 4388 | watch=w; | |
| 11600 | 4388 | return; | |
| 11601 | } | ||
| 11602 | |||
| 11603 | 21263 | move(step); | |
| 11604 | 21263 | break; | |
| 11605 | |||
| 11606 | case 6: | ||
| 11607 | case 7: | ||
| 11608 | 6468 | zc_swap(dir,clk3); | |
| 11609 | 6468 | dir^=1; | |
| 11610 | 6468 | move(step); | |
| 11611 | 6468 | dir^=1; | |
| 11612 | 6468 | zc_swap(dir,clk3); | |
| 11613 | 6468 | break; | |
| 11614 | |||
| 11615 | default: | ||
| 11616 | 104 | misc=0; | |
| 11617 | 104 | break; | |
| 11618 | } | ||
| 11619 | |||
| 11620 | 55761 | watch=w; | |
| 11621 | 74303 | } | |
| 11622 | |||
| 11623 | 3 | void eWallM::grabhero() | |
| 11624 | { | ||
| 11625 | 3 | hashero=true; | |
| 11626 | 3 | superman=1; | |
| 11627 | 3 | } | |
| 11628 | |||
| 11629 | 296315 | void eWallM::draw(BITMAP *dest) | |
| 11630 | { | ||
| 11631 | 296315 | dummy_bool[1]=hashero; | |
| 11632 | 296315 | update_enemy_frame(); | |
| 11633 | |||
| 11634 |
4/6✓ Branch 0 taken 215864 times.
✓ Branch 1 taken 80451 times.
✓ Branch 2 taken 215864 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 215864 times.
|
296315 | if(misc>0 || fallclk||drownclk) |
| 11635 | { | ||
| 11636 | 80451 | masked_draw(dest,16,playing_field_offset+16,224,144); | |
| 11637 | 80451 | } | |
| 11638 | |||
| 11639 | // enemy::draw(dest); | ||
| 11640 | // tile = clk&8 ? 128:129; | ||
| 11641 | 296315 | } | |
| 11642 | |||
| 11643 | ✗ | bool eWallM::isSubmerged() const | |
| 11644 | { | ||
| 11645 | ✗ | return ( !misc ); | |
| 11646 | } | ||
| 11647 | |||
| 11648 | 1406 | eTrap::eTrap(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 11649 | 1406 | { | |
| 11650 |
1/2✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
|
703 | ox=x; //original x |
| 11651 |
1/2✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
|
703 | oy=y; //original y |
| 11652 |
3/4✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 66 times.
✓ Branch 3 taken 637 times.
|
703 | if(get_bit(quest_rules,qr_TRAPPOSFIX)) |
| 11653 | { | ||
| 11654 |
3/6✓ Branch 0 taken 66 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 66 times.
✓ Branch 4 taken 66 times.
✗ Branch 5 not taken.
|
66 | yofs = (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 11655 | 66 | } | |
| 11656 | |||
| 11657 | 703 | mainguy=false; | |
| 11658 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
|
703 | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; |
| 11659 | //nets+420; | ||
| 11660 | 703 | dummy_int[1]=0; | |
| 11661 | 703 | SIZEflags = d->SIZEflags; | |
| 11662 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
703 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 11663 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 11664 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 11665 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
703 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 11666 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
703 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 11667 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
703 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 11668 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
703 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 11669 |
1/2✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
|
703 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 11670 |
1/2✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
|
703 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 11671 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 11672 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
703 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 11673 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
|
703 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 11674 | { | ||
| 11675 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 11676 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 11677 | ✗ | } | |
| 11678 | |||
| 11679 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
703 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 11680 | 703 | } | |
| 11681 | |||
| 11682 | 497627 | bool eTrap::animate(int32_t index) | |
| 11683 | { | ||
| 11684 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 497627 times.
|
497627 | if(switch_hooked) return enemy::animate(index); |
| 11685 |
2/4✓ Branch 0 taken 497627 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 497627 times.
|
497627 | if(fallclk||drownclk) return enemy::animate(index); |
| 11686 |
2/2✓ Branch 0 taken 487789 times.
✓ Branch 1 taken 9838 times.
|
497627 | if(clk<0) |
| 11687 | 9838 | return enemy::animate(index); | |
| 11688 | |||
| 11689 |
2/2✓ Branch 0 taken 456955 times.
✓ Branch 1 taken 30834 times.
|
487789 | if(clk==0) |
| 11690 | { | ||
| 11691 | 30834 | removearmos(x,y,ffcactivated); | |
| 11692 | 30834 | } | |
| 11693 | |||
| 11694 |
2/2✓ Branch 0 taken 128229 times.
✓ Branch 1 taken 359560 times.
|
487789 | if(misc==0) // waiting |
| 11695 | { | ||
| 11696 | 359560 | ox = x; | |
| 11697 | 359560 | oy = y; | |
| 11698 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 11699 | 359560 | double ddir=atan2_MSVC2022_FIX(double(y-(Hero.y)),double(Hero.x-x)); | |
| 11700 | |||
| 11701 |
4/4✓ Branch 0 taken 117876 times.
✓ Branch 1 taken 241684 times.
✓ Branch 2 taken 70558 times.
✓ Branch 3 taken 47318 times.
|
359560 | if((ddir<=(((-1)*PI)/4))&&(ddir>(((-3)*PI)/4))) |
| 11702 | { | ||
| 11703 | 47318 | dir=down; | |
| 11704 | 47318 | } | |
| 11705 |
4/4✓ Branch 0 taken 210906 times.
✓ Branch 1 taken 101336 times.
✓ Branch 2 taken 70558 times.
✓ Branch 3 taken 140348 times.
|
312242 | else if((ddir<=(((1)*PI)/4))&&(ddir>(((-1)*PI)/4))) |
| 11706 | { | ||
| 11707 | 140348 | dir=right; | |
| 11708 | 140348 | } | |
| 11709 |
4/4✓ Branch 0 taken 107679 times.
✓ Branch 1 taken 64215 times.
✓ Branch 2 taken 70558 times.
✓ Branch 3 taken 37121 times.
|
171894 | else if((ddir<=(((3)*PI)/4))&&(ddir>(((1)*PI)/4))) |
| 11710 | { | ||
| 11711 | 37121 | dir=up; | |
| 11712 | 37121 | } | |
| 11713 | else | ||
| 11714 | { | ||
| 11715 | 134773 | dir=left; | |
| 11716 | } | ||
| 11717 | |||
| 11718 | 359560 | int32_t d2=lined_up(15,true); | |
| 11719 | |||
| 11720 |
4/4✓ Branch 0 taken 123433 times.
✓ Branch 1 taken 236127 times.
✓ Branch 2 taken 668121 times.
✓ Branch 3 taken 308561 times.
|
586833 | if(((d2<left || d2 > right) && (dmisc1==1)) || |
| 11721 |
2/2✓ Branch 0 taken 118589 times.
✓ Branch 1 taken 189972 times.
|
308561 | ((d2>down) && (dmisc1==2)) || |
| 11722 |
2/2✓ Branch 0 taken 111768 times.
✓ Branch 1 taken 78204 times.
|
189972 | ((d2>right) && (!dmisc1)) || |
| 11723 |
2/2✓ Branch 0 taken 227273 times.
✓ Branch 1 taken 48451 times.
|
189972 | ((d2<l_up) && (dmisc1==4)) || |
| 11724 |
3/4✓ Branch 0 taken 227273 times.
✓ Branch 1 taken 178822 times.
✓ Branch 2 taken 227273 times.
✗ Branch 3 not taken.
|
48451 | ((d2!=r_up) && (d2!=l_down) && (dmisc1==6)) || |
| 11725 |
3/4✓ Branch 0 taken 227273 times.
✓ Branch 1 taken 48451 times.
✓ Branch 2 taken 227273 times.
✗ Branch 3 not taken.
|
178822 | ((d2!=l_up) && (d2!=r_down) && (dmisc1==8))) |
| 11726 | { | ||
| 11727 | 1468529 | d2=-1; | |
| 11728 | 1468529 | } | |
| 11729 | |||
| 11730 |
4/4✓ Branch 0 taken 9596 times.
✓ Branch 1 taken 171142 times.
✓ Branch 2 taken 8613 times.
✓ Branch 3 taken 983 times.
|
180738 | if(d2!=-1 && trapmove(d2)) |
| 11731 | { | ||
| 11732 | 983 | dir=d2; | |
| 11733 | 983 | misc=1; | |
| 11734 | 983 | clk2=(dir==down)?3:0; | |
| 11735 | 983 | } | |
| 11736 | 180738 | } | |
| 11737 | |||
| 11738 |
2/2✓ Branch 0 taken 273905 times.
✓ Branch 1 taken 35062 times.
|
308967 | if(misc==1) // charging |
| 11739 | { | ||
| 11740 | 35062 | clk2=(clk2+1)&3; | |
| 11741 | 35062 | step=(clk2==3)?1:2; | |
| 11742 | |||
| 11743 |
4/4✓ Branch 0 taken 35012 times.
✓ Branch 1 taken 50 times.
✓ Branch 2 taken 860 times.
✓ Branch 3 taken 34152 times.
|
35062 | if(!trapmove(dir) || clip()) |
| 11744 | { | ||
| 11745 | 910 | misc=2; | |
| 11746 | |||
| 11747 |
1/2✓ Branch 0 taken 910 times.
✗ Branch 1 not taken.
|
910 | if(dir<l_up) |
| 11748 | { | ||
| 11749 | 910 | dir=dir^1; | |
| 11750 | 910 | } | |
| 11751 | else | ||
| 11752 | { | ||
| 11753 | ✗ | dir=dir^3; | |
| 11754 | } | ||
| 11755 | 910 | } | |
| 11756 | else | ||
| 11757 | { | ||
| 11758 | 34152 | sprite::move(step); | |
| 11759 | } | ||
| 11760 | 35062 | } | |
| 11761 | |||
| 11762 |
2/2✓ Branch 0 taken 213907 times.
✓ Branch 1 taken 95060 times.
|
308967 | if(misc==2) // retreating |
| 11763 | { | ||
| 11764 | 95060 | step=(++clk2&1)?1:0; | |
| 11765 | |||
| 11766 |
4/9✗ Branch 0 not taken.
✓ Branch 1 taken 12080 times.
✓ Branch 2 taken 36053 times.
✓ Branch 3 taken 11271 times.
✓ Branch 4 taken 35656 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
95060 | switch(dir) |
| 11767 | { | ||
| 11768 | case up: | ||
| 11769 |
2/2✓ Branch 0 taken 107 times.
✓ Branch 1 taken 11973 times.
|
12080 | if(int32_t(y)<=oy) goto trap_rest; |
| 11770 | 11973 | else sprite::move(step); | |
| 11771 | |||
| 11772 | 11973 | break; | |
| 11773 | |||
| 11774 | case left: | ||
| 11775 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 35848 times.
|
36053 | if(int32_t(x)<=ox) goto trap_rest; |
| 11776 | 35848 | else sprite::move(step); | |
| 11777 | |||
| 11778 | 35848 | break; | |
| 11779 | |||
| 11780 | case down: | ||
| 11781 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 11163 times.
|
11271 | if(int32_t(y)>=oy) goto trap_rest; |
| 11782 | 11163 | else sprite::move(step); | |
| 11783 | |||
| 11784 | 11163 | break; | |
| 11785 | |||
| 11786 | case right: | ||
| 11787 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 35440 times.
|
35656 | if(int32_t(x)>=ox) goto trap_rest; |
| 11788 | 35440 | else sprite::move(step); | |
| 11789 | |||
| 11790 | 35440 | break; | |
| 11791 | |||
| 11792 | case l_up: | ||
| 11793 | ✗ | if(int32_t(x)<=ox && int32_t(y)<=oy) goto trap_rest; | |
| 11794 | ✗ | else sprite::move(step); | |
| 11795 | |||
| 11796 | ✗ | break; | |
| 11797 | |||
| 11798 | case r_up: | ||
| 11799 | ✗ | if(int32_t(x)>=ox && int32_t(y)<=oy) goto trap_rest; | |
| 11800 | ✗ | else sprite::move(step); | |
| 11801 | |||
| 11802 | ✗ | break; | |
| 11803 | |||
| 11804 | case l_down: | ||
| 11805 | ✗ | if(int32_t(x)<=ox && int32_t(y)>=oy) goto trap_rest; | |
| 11806 | ✗ | else sprite::move(step); | |
| 11807 | |||
| 11808 | ✗ | break; | |
| 11809 | |||
| 11810 | case r_down: | ||
| 11811 | ✗ | if(int32_t(x)>=ox && int32_t(y)>=oy) goto trap_rest; | |
| 11812 | ✗ | else sprite::move(step); | |
| 11813 | |||
| 11814 | ✗ | break; | |
| 11815 | trap_rest: | ||
| 11816 | { | ||
| 11817 | 636 | x=ox; | |
| 11818 | 636 | y=oy; | |
| 11819 | 636 | misc=0; | |
| 11820 | } | ||
| 11821 | 636 | } | |
| 11822 | 95060 | } | |
| 11823 | |||
| 11824 | 308967 | return enemy::animate(index); | |
| 11825 | 318805 | } | |
| 11826 | |||
| 11827 | 44658 | bool eTrap::trapmove(int32_t ndir) | |
| 11828 | { | ||
| 11829 |
2/2✓ Branch 0 taken 30391 times.
✓ Branch 1 taken 14267 times.
|
44658 | if(get_bit(quest_rules,qr_MEANTRAPS)) |
| 11830 | { | ||
| 11831 |
2/2✓ Branch 0 taken 1340 times.
✓ Branch 1 taken 29051 times.
|
30391 | if(tmpscr->flags2&fFLOATTRAPS) |
| 11832 | 1340 | return canmove(ndir,(zfix)1,spw_floater, 0, 0, 15, 15,false); | |
| 11833 | |||
| 11834 | 29051 | return canmove(ndir,(zfix)1,spw_water, 0, 0, 15, 15,false); | |
| 11835 | } | ||
| 11836 | |||
| 11837 |
6/6✓ Branch 0 taken 6244 times.
✓ Branch 1 taken 8023 times.
✓ Branch 2 taken 4374 times.
✓ Branch 3 taken 1870 times.
✓ Branch 4 taken 1608 times.
✓ Branch 5 taken 2766 times.
|
14267 | if(oy==80 && !(ndir==left || ndir == right)) |
| 11838 | 2766 | return false; | |
| 11839 | |||
| 11840 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 11501 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
11501 | if(ox==128 && !(ndir==up || ndir==down)) |
| 11841 | ✗ | return false; | |
| 11842 | |||
| 11843 |
3/4✓ Branch 0 taken 4333 times.
✓ Branch 1 taken 7168 times.
✓ Branch 2 taken 4333 times.
✗ Branch 3 not taken.
|
11501 | if(oy<80 && ndir==up) |
| 11844 | ✗ | return false; | |
| 11845 | |||
| 11846 |
3/4✓ Branch 0 taken 3690 times.
✓ Branch 1 taken 7811 times.
✓ Branch 2 taken 3690 times.
✗ Branch 3 not taken.
|
11501 | if(oy>80 && ndir==down) |
| 11847 | ✗ | return false; | |
| 11848 | |||
| 11849 |
4/4✓ Branch 0 taken 5854 times.
✓ Branch 1 taken 5647 times.
✓ Branch 2 taken 5136 times.
✓ Branch 3 taken 718 times.
|
11501 | if(ox<128 && ndir==left) |
| 11850 | 718 | return false; | |
| 11851 | |||
| 11852 |
4/4✓ Branch 0 taken 5647 times.
✓ Branch 1 taken 5136 times.
✓ Branch 2 taken 5159 times.
✓ Branch 3 taken 488 times.
|
10783 | if(ox>128 && ndir==right) |
| 11853 | 488 | return false; | |
| 11854 | |||
| 11855 |
5/6✓ Branch 0 taken 5136 times.
✓ Branch 1 taken 5159 times.
✓ Branch 2 taken 2207 times.
✓ Branch 3 taken 2929 times.
✓ Branch 4 taken 2207 times.
✗ Branch 5 not taken.
|
10295 | if(ox<128 && oy<80 && ndir==l_up) |
| 11856 | ✗ | return false; | |
| 11857 | |||
| 11858 |
5/6✓ Branch 0 taken 5136 times.
✓ Branch 1 taken 5159 times.
✓ Branch 2 taken 1809 times.
✓ Branch 3 taken 3327 times.
✓ Branch 4 taken 1809 times.
✗ Branch 5 not taken.
|
10295 | if(ox<128 && oy>80 && ndir==l_down) |
| 11859 | ✗ | return false; | |
| 11860 | |||
| 11861 |
5/6✓ Branch 0 taken 5159 times.
✓ Branch 1 taken 5136 times.
✓ Branch 2 taken 2126 times.
✓ Branch 3 taken 3033 times.
✓ Branch 4 taken 2126 times.
✗ Branch 5 not taken.
|
10295 | if(ox>128 && oy<80 && ndir==r_up) |
| 11862 | ✗ | return false; | |
| 11863 | |||
| 11864 |
5/6✓ Branch 0 taken 5159 times.
✓ Branch 1 taken 5136 times.
✓ Branch 2 taken 1881 times.
✓ Branch 3 taken 3278 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1881 times.
|
10295 | if(ox>128 && oy>80 && ndir==r_down) |
| 11865 | ✗ | return false; | |
| 11866 | |||
| 11867 | 10295 | return true; | |
| 11868 | 44658 | } | |
| 11869 | |||
| 11870 | 35012 | bool eTrap::clip() | |
| 11871 | { | ||
| 11872 |
2/2✓ Branch 0 taken 1499 times.
✓ Branch 1 taken 33513 times.
|
35012 | if(get_bit(quest_rules,qr_MEANPLACEDTRAPS)) |
| 11873 | { | ||
| 11874 |
4/9✗ Branch 0 not taken.
✓ Branch 1 taken 550 times.
✓ Branch 2 taken 342 times.
✓ Branch 3 taken 344 times.
✓ Branch 4 taken 263 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
1499 | switch(dir) |
| 11875 | { | ||
| 11876 | case up: | ||
| 11877 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 550 times.
|
550 | if(y<=0) return true; |
| 11878 | |||
| 11879 | 550 | break; | |
| 11880 | |||
| 11881 | case down: | ||
| 11882 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 342 times.
|
342 | if(y>=160) return true; |
| 11883 | |||
| 11884 | 342 | break; | |
| 11885 | |||
| 11886 | case left: | ||
| 11887 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 344 times.
|
344 | if(x<=0) return true; |
| 11888 | |||
| 11889 | 344 | break; | |
| 11890 | |||
| 11891 | case right: | ||
| 11892 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 263 times.
|
263 | if(x>=240) return true; |
| 11893 | |||
| 11894 | 263 | break; | |
| 11895 | |||
| 11896 | case l_up: | ||
| 11897 | ✗ | if(y<=0||x<=0) return true; | |
| 11898 | |||
| 11899 | ✗ | break; | |
| 11900 | |||
| 11901 | case l_down: | ||
| 11902 | ✗ | if(y>=160||x<=0) return true; | |
| 11903 | |||
| 11904 | ✗ | break; | |
| 11905 | |||
| 11906 | case r_up: | ||
| 11907 | ✗ | if(y<=0||x>=240) return true; | |
| 11908 | |||
| 11909 | ✗ | break; | |
| 11910 | |||
| 11911 | case r_down: | ||
| 11912 | ✗ | if(y>=160||x>=240) return true; | |
| 11913 | |||
| 11914 | ✗ | break; | |
| 11915 | } | ||
| 11916 | |||
| 11917 | 1499 | return false; | |
| 11918 | } | ||
| 11919 | else | ||
| 11920 | { | ||
| 11921 |
4/9✗ Branch 0 not taken.
✓ Branch 1 taken 3745 times.
✓ Branch 2 taken 4135 times.
✓ Branch 3 taken 12605 times.
✓ Branch 4 taken 13028 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
33513 | switch(dir) |
| 11922 | { | ||
| 11923 | case up: | ||
| 11924 |
4/4✓ Branch 0 taken 3691 times.
✓ Branch 1 taken 54 times.
✓ Branch 2 taken 3546 times.
✓ Branch 3 taken 145 times.
|
3745 | if(oy>80 && y<=86) return true; |
| 11925 | |||
| 11926 | 3600 | break; | |
| 11927 | |||
| 11928 | case down: | ||
| 11929 |
4/4✓ Branch 0 taken 4054 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 3903 times.
✓ Branch 3 taken 151 times.
|
4135 | if(oy<80 && y>=80) return true; |
| 11930 | |||
| 11931 | 3984 | break; | |
| 11932 | |||
| 11933 | case left: | ||
| 11934 |
4/4✓ Branch 0 taken 12515 times.
✓ Branch 1 taken 90 times.
✓ Branch 2 taken 12236 times.
✓ Branch 3 taken 279 times.
|
12605 | if(ox>128 && x<=124) return true; |
| 11935 | |||
| 11936 | 12326 | break; | |
| 11937 | |||
| 11938 | case right: | ||
| 11939 |
3/4✓ Branch 0 taken 13028 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12743 times.
✓ Branch 3 taken 285 times.
|
13028 | if(ox<120 && x>=116) return true; |
| 11940 | |||
| 11941 | 12743 | break; | |
| 11942 | |||
| 11943 | case l_up: | ||
| 11944 | ✗ | if(oy>80 && y<=86 && ox>128 && x<=124) return true; | |
| 11945 | |||
| 11946 | ✗ | break; | |
| 11947 | |||
| 11948 | case l_down: | ||
| 11949 | ✗ | if(oy<80 && y>=80 && ox>128 && x<=124) return true; | |
| 11950 | |||
| 11951 | ✗ | break; | |
| 11952 | |||
| 11953 | case r_up: | ||
| 11954 | ✗ | if(oy>80 && y<=86 && ox<120 && x>=116) return true; | |
| 11955 | |||
| 11956 | ✗ | break; | |
| 11957 | |||
| 11958 | case r_down: | ||
| 11959 | ✗ | if(oy<80 && y>=80 && ox<120 && x>=116) return true; | |
| 11960 | |||
| 11961 | ✗ | break; | |
| 11962 | } | ||
| 11963 | |||
| 11964 | 32653 | return false; | |
| 11965 | } | ||
| 11966 | 35012 | } | |
| 11967 | |||
| 11968 | 499483 | void eTrap::draw(BITMAP *dest) | |
| 11969 | { | ||
| 11970 | 499483 | update_enemy_frame(); | |
| 11971 | 499483 | enemy::draw(dest); | |
| 11972 | 499483 | } | |
| 11973 | |||
| 11974 | 2383 | int32_t eTrap::takehit(weapon*,weapon*) | |
| 11975 | { | ||
| 11976 | 2383 | return 0; | |
| 11977 | } | ||
| 11978 | |||
| 11979 | 280 | eTrap2::eTrap2(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 11980 | 280 | { | |
| 11981 | 140 | lasthit=-1; | |
| 11982 | 140 | lasthitclk=0; | |
| 11983 | 140 | mainguy=false; | |
| 11984 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
|
140 | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; |
| 11985 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | step=2; |
| 11986 |
3/6✓ Branch 0 taken 80 times.
✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 80 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
140 | if(dmisc1==1 || (dmisc1==0 && zc_oldrand()&2)) |
| 11987 | { | ||
| 11988 |
2/4✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
|
60 | dir=(x<=112)?right:left; |
| 11989 | 60 | } | |
| 11990 | else | ||
| 11991 | { | ||
| 11992 |
2/4✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 80 times.
✗ Branch 3 not taken.
|
80 | dir=(y<=72)?down:up; |
| 11993 | } | ||
| 11994 | |||
| 11995 |
2/4✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 140 times.
|
140 | if(get_bit(quest_rules,qr_TRAPPOSFIX)) |
| 11996 | { | ||
| 11997 | ✗ | yofs = (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); | |
| 11998 | ✗ | } | |
| 11999 | |||
| 12000 | //nets+((id==eTRAP_LR)?540:520); | ||
| 12001 | 140 | dummy_int[1]=0; | |
| 12002 | 140 | SIZEflags = d->SIZEflags; | |
| 12003 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
140 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 12004 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 12005 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 12006 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
140 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 12007 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
140 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 12008 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
140 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 12009 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
140 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 12010 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 12011 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 12012 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 12013 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
140 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 12014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
|
140 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 12015 | { | ||
| 12016 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 12017 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 12018 | ✗ | } | |
| 12019 | |||
| 12020 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
140 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 12021 | 140 | } | |
| 12022 | |||
| 12023 | 83320 | bool eTrap2::animate(int32_t index) | |
| 12024 | { | ||
| 12025 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 83320 times.
|
83320 | if(switch_hooked) return enemy::animate(index); |
| 12026 |
2/4✓ Branch 0 taken 83320 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 83320 times.
|
83320 | if(fallclk||drownclk) return enemy::animate(index); |
| 12027 |
2/2✓ Branch 0 taken 81360 times.
✓ Branch 1 taken 1960 times.
|
83320 | if(clk<0) |
| 12028 | 1960 | return enemy::animate(index); | |
| 12029 | |||
| 12030 |
2/2✓ Branch 0 taken 5158 times.
✓ Branch 1 taken 76202 times.
|
81360 | if(clk==0) |
| 12031 | { | ||
| 12032 | 5158 | removearmos(x,y,ffcactivated); | |
| 12033 | 5158 | } | |
| 12034 | |||
| 12035 |
2/2✓ Branch 0 taken 76968 times.
✓ Branch 1 taken 4392 times.
|
81360 | if(!get_bit(quest_rules,qr_PHANTOMPLACEDTRAPS)) |
| 12036 | { | ||
| 12037 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4392 times.
|
4392 | if(lasthitclk>0) |
| 12038 | { | ||
| 12039 | ✗ | --lasthitclk; | |
| 12040 | ✗ | } | |
| 12041 | else | ||
| 12042 | { | ||
| 12043 | 4392 | lasthit=-1; | |
| 12044 | } | ||
| 12045 | |||
| 12046 | 4392 | bool hitenemy=false; | |
| 12047 | |||
| 12048 |
2/2✓ Branch 0 taken 57096 times.
✓ Branch 1 taken 4392 times.
|
61488 | for(int32_t j=0; j<guys.Count(); j++) |
| 12049 | { | ||
| 12050 |
3/4✓ Branch 0 taken 52704 times.
✓ Branch 1 taken 4392 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 52704 times.
|
57096 | if((j!=index) && (lasthit!=j)) |
| 12051 | { | ||
| 12052 |
1/2✓ Branch 0 taken 52704 times.
✗ Branch 1 not taken.
|
52704 | if(hit(guys.spr(j))) |
| 12053 | { | ||
| 12054 | ✗ | lasthit=j; | |
| 12055 | ✗ | lasthitclk=10; | |
| 12056 | ✗ | hitenemy=true; | |
| 12057 | ✗ | guys.spr(j)->lasthit=index; | |
| 12058 | ✗ | guys.spr(j)->lasthitclk=10; | |
| 12059 | // guys.spr(j)->dir=guys.spr(j)->dir^1; | ||
| 12060 | ✗ | } | |
| 12061 | 52704 | } | |
| 12062 | 57096 | } | |
| 12063 | |||
| 12064 |
4/6✓ Branch 0 taken 4344 times.
✓ Branch 1 taken 48 times.
✓ Branch 2 taken 4344 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4344 times.
|
4392 | if(!trapmove(dir) || clip() || hitenemy) |
| 12065 | { | ||
| 12066 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
48 | if(!trapmove(dir) || clip()) |
| 12067 | { | ||
| 12068 | 48 | lasthit=-1; | |
| 12069 | 48 | lasthitclk=0; | |
| 12070 | 48 | } | |
| 12071 | |||
| 12072 |
1/2✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
|
48 | if(get_bit(quest_rules,qr_MORESOUNDS)) |
| 12073 | ✗ | sfx(WAV_ZN1TAP,pan(int32_t(x))); | |
| 12074 | |||
| 12075 | 48 | dir=dir^1; | |
| 12076 | 48 | } | |
| 12077 | |||
| 12078 | 4392 | sprite::move(step); | |
| 12079 | 4392 | } | |
| 12080 | else | ||
| 12081 | { | ||
| 12082 |
3/4✓ Branch 0 taken 75261 times.
✓ Branch 1 taken 1707 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 75261 times.
|
76968 | if(!trapmove(dir) || clip()) |
| 12083 | { | ||
| 12084 |
1/2✓ Branch 0 taken 1707 times.
✗ Branch 1 not taken.
|
1707 | if(get_bit(quest_rules,qr_MORESOUNDS)) |
| 12085 | ✗ | sfx(WAV_ZN1TAP,pan(int32_t(x))); | |
| 12086 | |||
| 12087 | 1707 | dir=dir^1; | |
| 12088 | 1707 | } | |
| 12089 | |||
| 12090 | 76968 | sprite::move(step); | |
| 12091 | } | ||
| 12092 | |||
| 12093 | 81360 | return enemy::animate(index); | |
| 12094 | 83320 | } | |
| 12095 | |||
| 12096 | 81408 | bool eTrap2::trapmove(int32_t ndir) | |
| 12097 | { | ||
| 12098 |
2/2✓ Branch 0 taken 1878 times.
✓ Branch 1 taken 79530 times.
|
81408 | if(tmpscr->flags2&fFLOATTRAPS) |
| 12099 | 1878 | return canmove(ndir,(zfix)1,spw_floater, 0, 0, 15, 15,false); | |
| 12100 | |||
| 12101 | 79530 | return canmove(ndir,(zfix)1,spw_water, 0, 0, 15, 15,false); | |
| 12102 | 81408 | } | |
| 12103 | |||
| 12104 | 79605 | bool eTrap2::clip() | |
| 12105 | { | ||
| 12106 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 23387 times.
✓ Branch 2 taken 23376 times.
✓ Branch 3 taken 16303 times.
✓ Branch 4 taken 16539 times.
|
79605 | switch(dir) |
| 12107 | { | ||
| 12108 | case up: | ||
| 12109 |
1/2✓ Branch 0 taken 23387 times.
✗ Branch 1 not taken.
|
23387 | if(y<=0) return true; |
| 12110 | |||
| 12111 | 23387 | break; | |
| 12112 | |||
| 12113 | case down: | ||
| 12114 |
1/2✓ Branch 0 taken 23376 times.
✗ Branch 1 not taken.
|
23376 | if(y>=160) return true; |
| 12115 | |||
| 12116 | 23376 | break; | |
| 12117 | |||
| 12118 | case left: | ||
| 12119 |
1/2✓ Branch 0 taken 16303 times.
✗ Branch 1 not taken.
|
16303 | if(x<=0) return true; |
| 12120 | |||
| 12121 | 16303 | break; | |
| 12122 | |||
| 12123 | case right: | ||
| 12124 |
1/2✓ Branch 0 taken 16539 times.
✗ Branch 1 not taken.
|
16539 | if(x>=240) return true; |
| 12125 | |||
| 12126 | 16539 | break; | |
| 12127 | } | ||
| 12128 | |||
| 12129 | 79605 | return false; | |
| 12130 | 79605 | } | |
| 12131 | |||
| 12132 | 83330 | void eTrap2::draw(BITMAP *dest) | |
| 12133 | { | ||
| 12134 | 83330 | update_enemy_frame(); | |
| 12135 | 83330 | enemy::draw(dest); | |
| 12136 | 83330 | } | |
| 12137 | |||
| 12138 | 526 | int32_t eTrap2::takehit(weapon*,weapon*) | |
| 12139 | { | ||
| 12140 | 526 | return 0; | |
| 12141 | } | ||
| 12142 | |||
| 12143 | 416 | eRock::eRock(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 12144 | 416 | { | |
| 12145 | //do not show "enemy appering" anim -DD | ||
| 12146 | 208 | clk=0; | |
| 12147 | 208 | mainguy=false; | |
| 12148 | 208 | clk2=-14; | |
| 12149 | //Enemy Editor Size Tab | ||
| 12150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
|
208 | if ( (d->SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 12151 | 208 | else hxofs = -2; | |
| 12152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
|
208 | if ( (d->SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 12153 | 208 | else hyofs = -2; | |
| 12154 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
208 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && d->hxsz >= 0 ) hxsz = d->hxsz; |
| 12155 | 208 | else hxsz = 20; | |
| 12156 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
208 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && d->hysz >= 0 ) hysz = d->hysz; |
| 12157 | 208 | else hysz=20; | |
| 12158 | |||
| 12159 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
208 | if ( ((d->SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && d->txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 12160 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
208 | if ( ((d->SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && d->tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 12161 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
208 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && d->hzsz >= 0 ) hzsz = d->hzsz; |
| 12162 |
1/4✓ Branch 0 taken 208 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
208 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 12163 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
|
208 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 12164 | { | ||
| 12165 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 12166 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 12167 | ✗ | } | |
| 12168 | |||
| 12169 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 208 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
208 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 12170 | //nets+1640; | ||
| 12171 | 208 | } | |
| 12172 | |||
| 12173 | 71521 | bool eRock::animate(int32_t index) | |
| 12174 | { | ||
| 12175 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71521 times.
|
71521 | if(switch_hooked) return enemy::animate(index); |
| 12176 |
2/4✓ Branch 0 taken 71521 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 71521 times.
|
71521 | if(fallclk||drownclk) return enemy::animate(index); |
| 12177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71521 times.
|
71521 | if(dying) |
| 12178 | ✗ | return Dead(index); | |
| 12179 | |||
| 12180 |
2/2✓ Branch 0 taken 66484 times.
✓ Branch 1 taken 5037 times.
|
71521 | if(clk==0) |
| 12181 | { | ||
| 12182 | 5037 | removearmos(x,y,ffcactivated); | |
| 12183 | 5037 | } | |
| 12184 | |||
| 12185 |
2/2✓ Branch 0 taken 71119 times.
✓ Branch 1 taken 402 times.
|
71521 | if(++clk2==0) // start it |
| 12186 | { | ||
| 12187 | 402 | x=zc_oldrand()&0xF0; | |
| 12188 | 402 | y=0; | |
| 12189 | 402 | clk3=0; | |
| 12190 | 402 | clk2=zc_oldrand()&15; | |
| 12191 | 402 | } | |
| 12192 | |||
| 12193 |
2/2✓ Branch 0 taken 13144 times.
✓ Branch 1 taken 58377 times.
|
71521 | if(clk2>16) // move it |
| 12194 | { | ||
| 12195 |
2/2✓ Branch 0 taken 56364 times.
✓ Branch 1 taken 2013 times.
|
58377 | if(clk3<=0) // start bounce |
| 12196 | { | ||
| 12197 | 2013 | dir=zc_oldrand()&1; | |
| 12198 | |||
| 12199 |
2/2✓ Branch 0 taken 1784 times.
✓ Branch 1 taken 229 times.
|
2013 | if(x<32) dir=1; |
| 12200 | |||
| 12201 |
2/2✓ Branch 0 taken 1847 times.
✓ Branch 1 taken 166 times.
|
2013 | if(x>208) dir=0; |
| 12202 | 2013 | } | |
| 12203 | |||
| 12204 |
2/2✓ Branch 0 taken 56499 times.
✓ Branch 1 taken 1878 times.
|
58377 | if(clk3<13+16) |
| 12205 | { | ||
| 12206 | 56499 | x += dir ? 1 : -1; //right, left | |
| 12207 | 56499 | dummy_int[1]=dir; | |
| 12208 | |||
| 12209 |
2/2✓ Branch 0 taken 4021 times.
✓ Branch 1 taken 52478 times.
|
56499 | if(clk3<2) |
| 12210 | { | ||
| 12211 | 4021 | y-=2; //up | |
| 12212 | 4021 | dummy_int[2]=(dummy_int[1]==1)?r_up:l_up; | |
| 12213 | 4021 | } | |
| 12214 |
2/2✓ Branch 0 taken 5996 times.
✓ Branch 1 taken 46482 times.
|
52478 | else if(clk3<5) |
| 12215 | { | ||
| 12216 | 5996 | y--; //up | |
| 12217 | 5996 | dummy_int[2]=(dummy_int[1]==1)?r_up:l_up; | |
| 12218 | 5996 | } | |
| 12219 |
2/2✓ Branch 0 taken 5959 times.
✓ Branch 1 taken 40523 times.
|
46482 | else if(clk3<8) |
| 12220 | { | ||
| 12221 | 5959 | dummy_int[2]=(dummy_int[1]==1)?right:left; | |
| 12222 | 5959 | } | |
| 12223 |
2/2✓ Branch 0 taken 5911 times.
✓ Branch 1 taken 34612 times.
|
40523 | else if(clk3<11) |
| 12224 | { | ||
| 12225 | 5911 | y++; //down | |
| 12226 | 5911 | dummy_int[2]=(dummy_int[1]==1)?r_down:l_down; | |
| 12227 | 5911 | } | |
| 12228 | else | ||
| 12229 | { | ||
| 12230 | 34612 | y+=2; //down | |
| 12231 | 34612 | dummy_int[2]=(dummy_int[1]==1)?r_down:l_down; | |
| 12232 | } | ||
| 12233 | |||
| 12234 | 56499 | ++clk3; | |
| 12235 | 56499 | } | |
| 12236 |
2/2✓ Branch 0 taken 1627 times.
✓ Branch 1 taken 251 times.
|
1878 | else if(y<176) |
| 12237 | 1627 | clk3=0; // next bounce | |
| 12238 | else | ||
| 12239 | 251 | clk2 = -(zc_oldrand()&63); // back to top | |
| 12240 | 58377 | } | |
| 12241 | |||
| 12242 | 71521 | return enemy::animate(index); | |
| 12243 | 71521 | } | |
| 12244 | |||
| 12245 | 14169 | void eRock::drawshadow(BITMAP *dest, bool translucent) | |
| 12246 | { | ||
| 12247 |
2/2✓ Branch 0 taken 1822 times.
✓ Branch 1 taken 12347 times.
|
14169 | if(clk2>=0) |
| 12248 | { | ||
| 12249 | 12347 | int32_t tempy=yofs; | |
| 12250 | 12347 | flip = 0; | |
| 12251 | 12347 | int32_t fdiv = frate/4; | |
| 12252 |
1/2✓ Branch 0 taken 12347 times.
✗ Branch 1 not taken.
|
12347 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 12253 |
1/2✓ Branch 0 taken 12347 times.
✗ Branch 1 not taken.
|
12347 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 12254 | 12347 | efrate:((clk>=(frate>>1))?1:0); | |
| 12255 | 12347 | shadowtile = wpnsbuf[spr_shadow].tile+f2; | |
| 12256 | |||
| 12257 | 12347 | yofs+=8; | |
| 12258 |
5/6✓ Branch 0 taken 5808 times.
✓ Branch 1 taken 6539 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12347 times.
✓ Branch 4 taken 5808 times.
✓ Branch 5 taken 6539 times.
|
12347 | yofs+=zc_max(0,zc_min(29-clk3,clk3)); |
| 12259 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12347 times.
|
12347 | if(!shadow_overpit(this)) |
| 12260 | 12347 | enemy::drawshadow(dest, translucent); | |
| 12261 | 12347 | yofs=tempy; | |
| 12262 | 12347 | } | |
| 12263 | 14169 | } | |
| 12264 | |||
| 12265 | 71582 | void eRock::draw(BITMAP *dest) | |
| 12266 | { | ||
| 12267 |
4/6✓ Branch 0 taken 9822 times.
✓ Branch 1 taken 61760 times.
✓ Branch 2 taken 9822 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9822 times.
|
71582 | if(clk2>=0 || fallclk||drownclk) |
| 12268 | { | ||
| 12269 | 61760 | int32_t tempdir=dir; | |
| 12270 | 61760 | dir=dummy_int[2]; | |
| 12271 | 61760 | update_enemy_frame(); | |
| 12272 | 61760 | enemy::draw(dest); | |
| 12273 | 61760 | dir=tempdir; | |
| 12274 | 61760 | } | |
| 12275 | 71582 | } | |
| 12276 | |||
| 12277 | 718 | int32_t eRock::takehit(weapon*,weapon*) | |
| 12278 | { | ||
| 12279 | 718 | return 0; | |
| 12280 | } | ||
| 12281 | |||
| 12282 | 60 | eBoulder::eBoulder(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 12283 | 60 | { | |
| 12284 | 30 | clk=0; | |
| 12285 | 30 | mainguy=false; | |
| 12286 | 30 | clk2=-14; | |
| 12287 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if ( (d->SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 12288 | 30 | else hxofs= -10; | |
| 12289 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if ( (d->SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 12290 | 30 | else hyofs=-10; | |
| 12291 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && d->hxsz >= 0 ) hxsz = d->hxsz; |
| 12292 | 30 | else hxsz=36; | |
| 12293 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && d->hysz >= 0 ) hysz = d->hysz; |
| 12294 | 30 | else hysz=36; | |
| 12295 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && d->hzsz >= 0 ) hzsz = d->hzsz; |
| 12296 | 30 | else hzsz=16; //can't be jumped | |
| 12297 | |||
| 12298 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
30 | if ( ((d->SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && d->txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 12299 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
30 | if ( ((d->SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && d->tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 12300 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | if ( ((d->SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && d->hxsz >= 0 ) hxsz = d->hxsz; |
| 12301 |
1/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 12302 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 12303 | { | ||
| 12304 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 12305 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 12306 | ✗ | } | |
| 12307 | |||
| 12308 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | if ( (d->SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 12309 | //nets+1680; | ||
| 12310 | 30 | } | |
| 12311 | |||
| 12312 | 4440 | bool eBoulder::animate(int32_t index) | |
| 12313 | { | ||
| 12314 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4440 times.
|
4440 | if(switch_hooked) return enemy::animate(index); |
| 12315 |
2/4✓ Branch 0 taken 4440 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4440 times.
|
4440 | if(fallclk||drownclk) return enemy::animate(index); |
| 12316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4440 times.
|
4440 | if(dying) |
| 12317 | ✗ | return Dead(index); | |
| 12318 | |||
| 12319 |
2/2✓ Branch 0 taken 4150 times.
✓ Branch 1 taken 290 times.
|
4440 | if(clk==0) |
| 12320 | { | ||
| 12321 | 290 | removearmos(x,y,ffcactivated); | |
| 12322 | 290 | } | |
| 12323 | |||
| 12324 | zfix *vert; | ||
| 12325 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 4440 times.
✓ Branch 2 taken 4440 times.
✗ Branch 3 not taken.
|
4440 | vert = (moveflags & FLAG_USE_FAKE_Z) ? &fakez : get_bit(quest_rules,qr_ENEMIESZAXIS) ? &z : &y; |
| 12326 | |||
| 12327 |
2/2✓ Branch 0 taken 4408 times.
✓ Branch 1 taken 32 times.
|
4440 | if(++clk2==0) // start it |
| 12328 | { | ||
| 12329 | 32 | x=zc_oldrand()&0xF0; | |
| 12330 | 32 | y=-32; | |
| 12331 | 32 | clk3=0; | |
| 12332 | 32 | clk2=zc_oldrand()&15; | |
| 12333 | 32 | } | |
| 12334 | |||
| 12335 |
2/2✓ Branch 0 taken 842 times.
✓ Branch 1 taken 3598 times.
|
4440 | if(clk2>16) // move it |
| 12336 | { | ||
| 12337 |
2/2✓ Branch 0 taken 3467 times.
✓ Branch 1 taken 131 times.
|
3598 | if(clk3<=0) // start bounce |
| 12338 | { | ||
| 12339 | 131 | dir=zc_oldrand()&1; | |
| 12340 | |||
| 12341 |
2/2✓ Branch 0 taken 121 times.
✓ Branch 1 taken 10 times.
|
131 | if(x<32) dir=1; |
| 12342 | |||
| 12343 |
2/2✓ Branch 0 taken 115 times.
✓ Branch 1 taken 16 times.
|
131 | if(x>208) dir=0; |
| 12344 | 131 | } | |
| 12345 | |||
| 12346 |
2/2✓ Branch 0 taken 3487 times.
✓ Branch 1 taken 111 times.
|
3598 | if(clk3<13+16) |
| 12347 | { | ||
| 12348 | 3487 | x += dir ? 1 : -1; //right, left | |
| 12349 | 3487 | dummy_int[1]=dir; | |
| 12350 | |||
| 12351 |
2/2✓ Branch 0 taken 261 times.
✓ Branch 1 taken 3226 times.
|
3487 | if(clk3<2) |
| 12352 | { | ||
| 12353 | 261 | y-=2; //up | |
| 12354 | 261 | dummy_int[2]=(dummy_int[1]==1)?r_up:l_up; | |
| 12355 | 261 | } | |
| 12356 |
2/2✓ Branch 0 taken 382 times.
✓ Branch 1 taken 2844 times.
|
3226 | else if(clk3<5) |
| 12357 | { | ||
| 12358 | 382 | y--; //up | |
| 12359 | 382 | dummy_int[2]=(dummy_int[1]==1)?r_up:l_up; | |
| 12360 | 382 | } | |
| 12361 |
2/2✓ Branch 0 taken 376 times.
✓ Branch 1 taken 2468 times.
|
2844 | else if(clk3<8) |
| 12362 | { | ||
| 12363 | 376 | dummy_int[2]=(dummy_int[1]==1)?right:left; | |
| 12364 | 376 | } | |
| 12365 |
2/2✓ Branch 0 taken 367 times.
✓ Branch 1 taken 2101 times.
|
2468 | else if(clk3<11) |
| 12366 | { | ||
| 12367 | 367 | y++; //down | |
| 12368 | 367 | dummy_int[2]=(dummy_int[1]==1)?r_down:l_down; | |
| 12369 | 367 | } | |
| 12370 | else | ||
| 12371 | { | ||
| 12372 | 2101 | y+=2; //down | |
| 12373 | 2101 | dummy_int[2]=(dummy_int[1]==1)?r_down:l_down; | |
| 12374 | } | ||
| 12375 | |||
| 12376 | 3487 | ++clk3; | |
| 12377 | 3487 | } | |
| 12378 |
2/2✓ Branch 0 taken 101 times.
✓ Branch 1 taken 10 times.
|
111 | else if(y<176) |
| 12379 | 101 | clk3=0; // next bounce | |
| 12380 | else | ||
| 12381 | 10 | clk2 = -(zc_oldrand()&63); // back to top | |
| 12382 | 3598 | } | |
| 12383 | |||
| 12384 | 4440 | return enemy::animate(index); | |
| 12385 | 4440 | } | |
| 12386 | |||
| 12387 | 4440 | void eBoulder::drawshadow(BITMAP *dest, bool translucent) | |
| 12388 | { | ||
| 12389 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 3868 times.
|
4440 | if(clk2>=0) |
| 12390 | { | ||
| 12391 | 3868 | int32_t tempy=yofs; | |
| 12392 | 3868 | flip = 0; | |
| 12393 | 3868 | int32_t f2=((clk<<2)/frate)<<1; | |
| 12394 | 3868 | shadowtile = wpnsbuf[spr_shadow].tile+f2; | |
| 12395 |
5/6✓ Branch 0 taken 1729 times.
✓ Branch 1 taken 2139 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3868 times.
✓ Branch 4 taken 1729 times.
✓ Branch 5 taken 2139 times.
|
3868 | yofs+=zc_max(0,zc_min(29-clk3,clk3)); |
| 12396 | |||
| 12397 | 3868 | yofs+=8; | |
| 12398 | 3868 | xofs-=8; | |
| 12399 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3868 times.
|
3868 | if(!shadow_overpit(this)) |
| 12400 | 3868 | enemy::drawshadow(dest, translucent); | |
| 12401 | 3868 | xofs+=16; | |
| 12402 | 3868 | ++shadowtile; | |
| 12403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3868 times.
|
3868 | if(!shadow_overpit(this)) |
| 12404 | 3868 | enemy::drawshadow(dest, translucent); | |
| 12405 | 3868 | yofs+=16; | |
| 12406 | 3868 | shadowtile+=20; | |
| 12407 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3868 times.
|
3868 | if(!shadow_overpit(this)) |
| 12408 | 3868 | enemy::drawshadow(dest, translucent); | |
| 12409 | 3868 | xofs-=16; | |
| 12410 | 3868 | --shadowtile; | |
| 12411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3868 times.
|
3868 | if(!shadow_overpit(this)) |
| 12412 | 3868 | enemy::drawshadow(dest, translucent); | |
| 12413 | 3868 | xofs+=8; | |
| 12414 | 3868 | yofs=tempy; | |
| 12415 | 3868 | } | |
| 12416 | 4440 | } | |
| 12417 | |||
| 12418 | 4440 | void eBoulder::draw(BITMAP *dest) | |
| 12419 | { | ||
| 12420 |
4/6✓ Branch 0 taken 572 times.
✓ Branch 1 taken 3868 times.
✓ Branch 2 taken 572 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 572 times.
|
4440 | if(clk2>=0 || fallclk||drownclk) |
| 12421 | { | ||
| 12422 | 3868 | int32_t tempdir=dir; | |
| 12423 | 3868 | dir=dummy_int[2]; | |
| 12424 | 3868 | update_enemy_frame(); | |
| 12425 | 3868 | dir=tempdir; | |
| 12426 | 3868 | xofs-=8; | |
| 12427 | 3868 | yofs-=8; | |
| 12428 | 3868 | drawblock(dest,15); | |
| 12429 | 3868 | xofs+=8; | |
| 12430 | 3868 | yofs+=8; | |
| 12431 | // enemy::draw(dest); | ||
| 12432 | 3868 | } | |
| 12433 | 4440 | } | |
| 12434 | |||
| 12435 | ✗ | int32_t eBoulder::takehit(weapon*,weapon*) | |
| 12436 | { | ||
| 12437 | ✗ | return 0; | |
| 12438 | } | ||
| 12439 | |||
| 12440 | 4254 | eProjectile::eProjectile(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk), | |
| 12441 |
3/4✓ Branch 0 taken 2127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 514 times.
✓ Branch 3 taken 1613 times.
|
2127 | minRange(get_bit(quest_rules, qr_BROKENSTATUES) ? 0 : Clk) |
| 12442 | 4254 | { | |
| 12443 | /* fixing | ||
| 12444 | hp=1; | ||
| 12445 | */ | ||
| 12446 | 2127 | mainguy=false; | |
| 12447 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 2120 times.
|
2127 | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; |
| 12448 | 2127 | hclk=clk; // the "no fire" range | |
| 12449 | 2127 | clk=0; | |
| 12450 | 2127 | clk3=96; | |
| 12451 | 2127 | timer=0; | |
| 12452 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 2120 times.
|
2127 | if(o_tile==0) |
| 12453 | { | ||
| 12454 | 2120 | superman=1; | |
| 12455 | 2120 | hxofs=1000; | |
| 12456 | 2120 | } | |
| 12457 | 2127 | SIZEflags = d->SIZEflags; | |
| 12458 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2127 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 12459 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 12460 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 12461 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2127 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 12462 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2127 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 12463 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2127 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 12464 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2127 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 12465 |
1/2✓ Branch 0 taken 2127 times.
✗ Branch 1 not taken.
|
2127 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 12466 |
1/2✓ Branch 0 taken 2127 times.
✗ Branch 1 not taken.
|
2127 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 12467 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 12468 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2127 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 12469 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
|
2127 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 12470 | { | ||
| 12471 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 12472 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 12473 | ✗ | } | |
| 12474 | |||
| 12475 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2127 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 12476 | 2127 | } | |
| 12477 | |||
| 12478 | 1509951 | bool eProjectile::animate(int32_t index) | |
| 12479 | { | ||
| 12480 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1509951 times.
|
1509951 | if(switch_hooked) return enemy::animate(index); |
| 12481 |
2/4✓ Branch 0 taken 1509951 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1509951 times.
|
1509951 | if(fallclk||drownclk) return enemy::animate(index); |
| 12482 |
2/2✓ Branch 0 taken 1502702 times.
✓ Branch 1 taken 7249 times.
|
1509951 | if(clk==0) |
| 12483 | { | ||
| 12484 | 7249 | removearmos(x,y,ffcactivated); | |
| 12485 | 7249 | } | |
| 12486 | |||
| 12487 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 12488 | 1509951 | double ddir=atan2_MSVC2022_FIX(double(y-(Hero.y)),double(Hero.x-x)); | |
| 12489 | |||
| 12490 |
4/4✓ Branch 0 taken 493988 times.
✓ Branch 1 taken 1015963 times.
✓ Branch 2 taken 270279 times.
✓ Branch 3 taken 223709 times.
|
1509951 | if((ddir<=(((-1)*PI)/4))&&(ddir>(((-3)*PI)/4))) |
| 12491 | { | ||
| 12492 | 223709 | dir=down; | |
| 12493 | 223709 | } | |
| 12494 |
4/4✓ Branch 0 taken 824870 times.
✓ Branch 1 taken 461372 times.
✓ Branch 2 taken 270279 times.
✓ Branch 3 taken 554591 times.
|
1286242 | else if((ddir<=(((1)*PI)/4))&&(ddir>(((-1)*PI)/4))) |
| 12495 | { | ||
| 12496 | 554591 | dir=right; | |
| 12497 | 554591 | } | |
| 12498 |
4/4✓ Branch 0 taken 506887 times.
✓ Branch 1 taken 224764 times.
✓ Branch 2 taken 270279 times.
✓ Branch 3 taken 236608 times.
|
731651 | else if((ddir<=(((3)*PI)/4))&&(ddir>(((1)*PI)/4))) |
| 12499 | { | ||
| 12500 | 236608 | dir=up; | |
| 12501 | 236608 | } | |
| 12502 | else | ||
| 12503 | { | ||
| 12504 | 495043 | dir=left; | |
| 12505 | } | ||
| 12506 | |||
| 12507 |
3/4✓ Branch 0 taken 1509951 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 789235 times.
✓ Branch 3 taken 720716 times.
|
1509951 | if(!stunclk && ++clk3>80) |
| 12508 | { | ||
| 12509 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 720716 times.
|
720716 | if(dmisc1==9) // Breath type |
| 12510 | { | ||
| 12511 | ✗ | if(timer==0) | |
| 12512 | { | ||
| 12513 | ✗ | unsigned r=zc_oldrand(); | |
| 12514 | |||
| 12515 | ✗ | if(!(r&63)) | |
| 12516 | { | ||
| 12517 | ✗ | timer=zc_oldrand()%50+50; | |
| 12518 | ✗ | } | |
| 12519 | ✗ | } | |
| 12520 | |||
| 12521 | ✗ | if(timer>0) | |
| 12522 | { | ||
| 12523 | ✗ | if(timer%4==0) | |
| 12524 | { | ||
| 12525 | ✗ | FireBreath(false); | |
| 12526 | ✗ | } | |
| 12527 | |||
| 12528 | ✗ | if(--timer==0) | |
| 12529 | { | ||
| 12530 | ✗ | clk3=0; | |
| 12531 | ✗ | } | |
| 12532 | ✗ | } | |
| 12533 | ✗ | } | |
| 12534 | |||
| 12535 | else // Not breath type | ||
| 12536 | { | ||
| 12537 | 720716 | unsigned r=zc_oldrand(); | |
| 12538 | |||
| 12539 |
4/4✓ Branch 0 taken 11277 times.
✓ Branch 1 taken 709439 times.
✓ Branch 2 taken 835 times.
✓ Branch 3 taken 10442 times.
|
720716 | if(!(r&63) && !HeroInRange(minRange)) |
| 12540 | { | ||
| 12541 | 10442 | FireWeapon(); | |
| 12542 | |||
| 12543 |
3/4✓ Branch 0 taken 8071 times.
✓ Branch 1 taken 2371 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 61 times.
|
10503 | if(get_bit(quest_rules, qr_BROKENSTATUES)==0 && |
| 12544 |
3/4✓ Branch 0 taken 61 times.
✓ Branch 1 taken 8010 times.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
|
8071 | ((wpn==ewFireball || wpn==ewFireball2) || dmisc1==e1tNORMAL)) |
| 12545 | { | ||
| 12546 |
2/2✓ Branch 0 taken 7611 times.
✓ Branch 1 taken 460 times.
|
8071 | if(!((r>>7)&15)) |
| 12547 | { | ||
| 12548 | 460 | x-=4; | |
| 12549 | 460 | FireWeapon(); | |
| 12550 | 460 | x+=4; | |
| 12551 | 460 | } | |
| 12552 | 8071 | } | |
| 12553 | |||
| 12554 | 10442 | clk3=0; | |
| 12555 | 10442 | } | |
| 12556 | } | ||
| 12557 | 720716 | } | |
| 12558 | |||
| 12559 | 1509951 | return enemy::animate(index); | |
| 12560 | 1509951 | } | |
| 12561 | |||
| 12562 | 1515526 | void eProjectile::draw(BITMAP *dest) | |
| 12563 | { | ||
| 12564 | 1515526 | update_enemy_frame(); | |
| 12565 | 1515526 | enemy::draw(dest); | |
| 12566 | 1515526 | } | |
| 12567 | |||
| 12568 | 46 | eTrigger::eTrigger(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 12569 | 46 | { | |
| 12570 | 23 | hxofs=1000; | |
| 12571 | 23 | } | |
| 12572 | |||
| 12573 | 4492 | void eTrigger::draw(BITMAP *dest) | |
| 12574 | { | ||
| 12575 | 4492 | update_enemy_frame(); | |
| 12576 | 4492 | enemy::draw(dest); | |
| 12577 | 4492 | } | |
| 12578 | |||
| 12579 | ✗ | void eTrigger::death_sfx() | |
| 12580 | { | ||
| 12581 | //silent death | ||
| 12582 | ✗ | } | |
| 12583 | |||
| 12584 | ✗ | eNPC::eNPC(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 12585 | ✗ | { | |
| 12586 | ✗ | o_tile+=wpnsbuf[iwNPCs].tile; | |
| 12587 | ✗ | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; | |
| 12588 | ✗ | SIZEflags = d->SIZEflags; | |
| 12589 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. | |
| 12590 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 12591 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 12592 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } | |
| 12593 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; | |
| 12594 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; | |
| 12595 | ✗ | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; | |
| 12596 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; | |
| 12597 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; | |
| 12598 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 12599 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; | |
| 12600 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) | |
| 12601 | { | ||
| 12602 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 12603 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 12604 | ✗ | } | |
| 12605 | |||
| 12606 | ✗ | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; | |
| 12607 | ✗ | } | |
| 12608 | |||
| 12609 | ✗ | bool eNPC::animate(int32_t index) | |
| 12610 | { | ||
| 12611 | ✗ | if(switch_hooked) return enemy::animate(index); | |
| 12612 | ✗ | if(dying) | |
| 12613 | ✗ | return Dead(index); | |
| 12614 | |||
| 12615 | ✗ | if(clk==0) | |
| 12616 | { | ||
| 12617 | ✗ | removearmos(x,y,ffcactivated); | |
| 12618 | ✗ | } | |
| 12619 | |||
| 12620 | ✗ | switch(dmisc2) | |
| 12621 | { | ||
| 12622 | case 0: | ||
| 12623 | { | ||
| 12624 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 12625 | ✗ | double ddir=atan2_MSVC2022_FIX(double(y-(Hero.y)),double(Hero.x-x)); | |
| 12626 | |||
| 12627 | ✗ | if((ddir<=(((-1)*PI)/4))&&(ddir>(((-3)*PI)/4))) | |
| 12628 | { | ||
| 12629 | ✗ | dir=down; | |
| 12630 | ✗ | } | |
| 12631 | |||
| 12632 | ✗ | else if((ddir<=(((1)*PI)/4))&&(ddir>(((-1)*PI)/4))) | |
| 12633 | { | ||
| 12634 | ✗ | dir=right; | |
| 12635 | ✗ | } | |
| 12636 | ✗ | else if((ddir<=(((3)*PI)/4))&&(ddir>(((1)*PI)/8))) | |
| 12637 | { | ||
| 12638 | ✗ | dir=up; | |
| 12639 | ✗ | } | |
| 12640 | else | ||
| 12641 | { | ||
| 12642 | ✗ | dir=left; | |
| 12643 | } | ||
| 12644 | } | ||
| 12645 | ✗ | break; | |
| 12646 | |||
| 12647 | case 1: | ||
| 12648 | ✗ | halting_walk(rate, homing, 0, hrate, 48); | |
| 12649 | |||
| 12650 | ✗ | if(clk2==1 && (misc < dmisc1) && !(zc_oldrand()&15)) | |
| 12651 | { | ||
| 12652 | ✗ | newdir(rate, homing, 0); | |
| 12653 | ✗ | clk2=48; | |
| 12654 | ✗ | ++misc; | |
| 12655 | ✗ | } | |
| 12656 | |||
| 12657 | ✗ | if(clk2==0) | |
| 12658 | ✗ | misc=0; | |
| 12659 | |||
| 12660 | ✗ | break; | |
| 12661 | } | ||
| 12662 | |||
| 12663 | ✗ | return enemy::animate(index); | |
| 12664 | ✗ | } | |
| 12665 | |||
| 12666 | ✗ | void eNPC::draw(BITMAP *dest) | |
| 12667 | { | ||
| 12668 | ✗ | update_enemy_frame(); | |
| 12669 | ✗ | enemy::draw(dest); | |
| 12670 | ✗ | } | |
| 12671 | |||
| 12672 | ✗ | int32_t eNPC::takehit(weapon*,weapon*) | |
| 12673 | { | ||
| 12674 | ✗ | return 0; | |
| 12675 | } | ||
| 12676 | |||
| 12677 | 188 | eSpinTile::eSpinTile(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 12678 | 188 | { | |
| 12679 |
1/2✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
|
94 | if(clk>0) // clk>0 when created by a Spinning Tile combo |
| 12680 | { | ||
| 12681 | 94 | o_tile=clk; | |
| 12682 | 94 | cs=id>>12; | |
| 12683 | 94 | } | |
| 12684 | |||
| 12685 | 94 | id=id&0xFFF; | |
| 12686 | 94 | clk=0; | |
| 12687 |
1/2✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
|
94 | step=0; |
| 12688 | 94 | mainguy=false; | |
| 12689 | 94 | SIZEflags = d->SIZEflags; | |
| 12690 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
94 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 12691 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 12692 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 12693 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
94 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 12694 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
94 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 12695 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
94 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 12696 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
94 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 12697 |
1/2✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
|
94 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 12698 |
1/2✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
|
94 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 12699 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 12700 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
94 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 12701 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
|
94 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 12702 | { | ||
| 12703 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 12704 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 12705 | ✗ | } | |
| 12706 | |||
| 12707 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 94 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
94 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 12708 | 94 | } | |
| 12709 | |||
| 12710 | 81 | void eSpinTile::facehero() | |
| 12711 | { | ||
| 12712 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 80 times.
|
81 | if(Hero.x-x==0) |
| 12713 | { | ||
| 12714 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (Hero.y + 8 < y) |
| 12715 | 1 | dir = up; | |
| 12716 | else | ||
| 12717 | ✗ | dir = down; | |
| 12718 | 1 | } | |
| 12719 | else | ||
| 12720 | { | ||
| 12721 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 12722 | 80 | double ddir=atan2_MSVC2022_FIX(double(y-(Hero.y)),double(Hero.x-x)); | |
| 12723 | |||
| 12724 |
4/4✓ Branch 0 taken 22 times.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 12 times.
|
80 | if((ddir <= -5.0*PI/8.0) && (ddir > -7.0*PI/8.0)) |
| 12725 | { | ||
| 12726 | 12 | dir=l_down; | |
| 12727 | 12 | } | |
| 12728 |
4/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 57 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 1 times.
|
68 | else if ((ddir <= -3.0*PI / 8.0) && (ddir > -5.0*PI / 8.0)) |
| 12729 | { | ||
| 12730 | 1 | dir=down; | |
| 12731 | 1 | } | |
| 12732 |
4/4✓ Branch 0 taken 22 times.
✓ Branch 1 taken 45 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 12 times.
|
67 | else if ((ddir <= -1.0*PI / 8.0) && (ddir > -3.0*PI / 8.0)) |
| 12733 | { | ||
| 12734 | 12 | dir=r_down; | |
| 12735 | 12 | } | |
| 12736 |
4/4✓ Branch 0 taken 16 times.
✓ Branch 1 taken 39 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 6 times.
|
55 | else if ((ddir <= 1.0*PI / 8.0) && (ddir > -1.0*PI / 8.0)) |
| 12737 | { | ||
| 12738 | 6 | dir=right; | |
| 12739 | 6 | } | |
| 12740 |
4/4✓ Branch 0 taken 27 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 17 times.
|
49 | else if ((ddir <= 3.0*PI / 8.0) && (ddir > 1.0*PI / 8.0)) |
| 12741 | { | ||
| 12742 | 17 | dir=r_up; | |
| 12743 | 17 | } | |
| 12744 |
4/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 8 times.
|
32 | else if ((ddir <= 5.0*PI / 8.0) && (ddir > 3.0*PI / 8.0)) |
| 12745 | { | ||
| 12746 | 8 | dir=up; | |
| 12747 | 8 | } | |
| 12748 |
4/4✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 10 times.
|
24 | else if ((ddir <= 7.0*PI / 8.0) && (ddir > 5.0*PI / 8.0)) |
| 12749 | { | ||
| 12750 | 6 | dir=l_up; | |
| 12751 | 6 | } | |
| 12752 | else | ||
| 12753 | { | ||
| 12754 | 18 | dir=left; | |
| 12755 | } | ||
| 12756 | } | ||
| 12757 | 81 | } | |
| 12758 | |||
| 12759 | |||
| 12760 | 15539 | bool eSpinTile::animate(int32_t index) | |
| 12761 | { | ||
| 12762 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15539 times.
|
15539 | if(switch_hooked) return enemy::animate(index); |
| 12763 |
2/4✓ Branch 0 taken 15539 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15539 times.
|
15539 | if(fallclk||drownclk) return enemy::animate(index); |
| 12764 |
2/2✓ Branch 0 taken 1152 times.
✓ Branch 1 taken 14387 times.
|
15539 | if(dying) |
| 12765 | { | ||
| 12766 | 1152 | return Dead(index); | |
| 12767 | } | ||
| 12768 | |||
| 12769 |
2/2✓ Branch 0 taken 13146 times.
✓ Branch 1 taken 1241 times.
|
14387 | if(clk==0) |
| 12770 | { | ||
| 12771 | 1241 | removearmos(x,y,ffcactivated); | |
| 12772 | 1241 | } | |
| 12773 | |||
| 12774 | 14387 | ++misc; | |
| 12775 | |||
| 12776 |
2/2✓ Branch 0 taken 14306 times.
✓ Branch 1 taken 81 times.
|
14387 | if(misc==96) |
| 12777 | { | ||
| 12778 | 81 | facehero(); | |
| 12779 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 12780 | 81 | double ddir=atan2_MSVC2022_FIX(double((Hero.y)-y),double(Hero.x-x)); | |
| 12781 | 81 | angular=true; | |
| 12782 | 81 | angle=ddir; | |
| 12783 | 81 | step=zslongToFix(dstep*100); | |
| 12784 | 81 | } | |
| 12785 | |||
| 12786 |
8/8✓ Branch 0 taken 14374 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 14359 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 14353 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 18 times.
✓ Branch 7 taken 14335 times.
|
14387 | if(y>186 || y<=-16 || x>272 || x<=-16) |
| 12787 | 52 | kickbucket(); | |
| 12788 | |||
| 12789 | 14387 | sprite::move(step); | |
| 12790 | 14387 | return enemy::animate(index); | |
| 12791 | 15539 | } | |
| 12792 | |||
| 12793 | 15457 | void eSpinTile::draw(BITMAP *dest) | |
| 12794 | { | ||
| 12795 | 15457 | update_enemy_frame(); | |
| 12796 | 15457 | y-=(misc>>4); | |
| 12797 | 15457 | yofs+=2; | |
| 12798 | 15457 | enemy::draw(dest); | |
| 12799 | 15457 | yofs-=2; | |
| 12800 | 15457 | y+=(misc>>4); | |
| 12801 | 15457 | } | |
| 12802 | |||
| 12803 | 15457 | void eSpinTile::drawshadow(BITMAP *dest, bool translucent) | |
| 12804 | { | ||
| 12805 | 15457 | flip = 0; | |
| 12806 | 15457 | shadowtile = wpnsbuf[spr_shadow].tile+(clk%4); | |
| 12807 | 15457 | yofs+=4; | |
| 12808 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15457 times.
|
15457 | if(!shadow_overpit(this)) |
| 12809 | 15457 | enemy::drawshadow(dest, translucent); | |
| 12810 | 15457 | yofs-=4; | |
| 12811 | 15457 | } | |
| 12812 | |||
| 12813 | 3074 | eZora::eZora(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,0) | |
| 12814 | 3074 | { | |
| 12815 | //these are here to bypass compiler warnings about unused arguments | ||
| 12816 | 1537 | Clk=Clk; | |
| 12817 | 1537 | mainguy=false; | |
| 12818 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
|
1537 | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; |
| 12819 | /*if((x>-17 && x<0) && iswaterex(tmpscr->data[(((int32_t)y&0xF0)+((int32_t)x>>4))])) | ||
| 12820 | { | ||
| 12821 | clk=1; | ||
| 12822 | }*/ | ||
| 12823 | //nets+880; | ||
| 12824 | 1537 | SIZEflags = d->SIZEflags; | |
| 12825 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1537 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 12826 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 12827 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 12828 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1537 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 12829 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1537 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 12830 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1537 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 12831 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1537 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 12832 |
1/2✓ Branch 0 taken 1537 times.
✗ Branch 1 not taken.
|
1537 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 12833 |
1/2✓ Branch 0 taken 1537 times.
✗ Branch 1 not taken.
|
1537 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 12834 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 12835 |
1/4✓ Branch 0 taken 1537 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1537 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 12836 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
|
1537 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 12837 | { | ||
| 12838 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 12839 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 12840 | ✗ | } | |
| 12841 | |||
| 12842 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1537 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1537 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 12843 | 1537 | } | |
| 12844 | |||
| 12845 | 371492 | void eZora::facehero() | |
| 12846 | { | ||
| 12847 |
2/2✓ Branch 0 taken 6205 times.
✓ Branch 1 taken 365287 times.
|
371492 | if(Hero.x-x==0) |
| 12848 | { | ||
| 12849 | 6205 | dir=(Hero.y+8<y)?up:down; | |
| 12850 | 6205 | } | |
| 12851 | else | ||
| 12852 | { | ||
| 12853 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 12854 | 365287 | double ddir=atan2_MSVC2022_FIX(double(y-(Hero.y)),double(Hero.x-x)); | |
| 12855 | |||
| 12856 |
4/4✓ Branch 0 taken 76242 times.
✓ Branch 1 taken 289045 times.
✓ Branch 2 taken 28788 times.
✓ Branch 3 taken 47454 times.
|
365287 | if((ddir<=(((-5)*PI)/8))&&(ddir>(((-7)*PI)/8))) |
| 12857 | { | ||
| 12858 | 47454 | dir=l_down; | |
| 12859 | 47454 | } | |
| 12860 |
4/4✓ Branch 0 taken 54307 times.
✓ Branch 1 taken 263526 times.
✓ Branch 2 taken 28788 times.
✓ Branch 3 taken 25519 times.
|
317833 | else if((ddir<=(((-3)*PI)/8))&&(ddir>(((-5)*PI)/8))) |
| 12861 | { | ||
| 12862 | 25519 | dir=down; | |
| 12863 | 25519 | } | |
| 12864 |
4/4✓ Branch 0 taken 73753 times.
✓ Branch 1 taken 218561 times.
✓ Branch 2 taken 28788 times.
✓ Branch 3 taken 44965 times.
|
292314 | else if((ddir<=(((-1)*PI)/8))&&(ddir>(((-3)*PI)/8))) |
| 12865 | { | ||
| 12866 | 44965 | dir=r_down; | |
| 12867 | 44965 | } | |
| 12868 |
4/4✓ Branch 0 taken 98242 times.
✓ Branch 1 taken 149107 times.
✓ Branch 2 taken 28788 times.
✓ Branch 3 taken 69454 times.
|
247349 | else if((ddir<=(((1)*PI)/8))&&(ddir>(((-1)*PI)/8))) |
| 12869 | { | ||
| 12870 | 69454 | dir=right; | |
| 12871 | 69454 | } | |
| 12872 |
4/4✓ Branch 0 taken 78596 times.
✓ Branch 1 taken 99299 times.
✓ Branch 2 taken 28788 times.
✓ Branch 3 taken 49808 times.
|
177895 | else if((ddir<=(((3)*PI)/8))&&(ddir>(((1)*PI)/8))) |
| 12873 | { | ||
| 12874 | 49808 | dir=r_up; | |
| 12875 | 49808 | } | |
| 12876 |
4/4✓ Branch 0 taken 51731 times.
✓ Branch 1 taken 76356 times.
✓ Branch 2 taken 28788 times.
✓ Branch 3 taken 22943 times.
|
128087 | else if((ddir<=(((5)*PI)/8))&&(ddir>(((3)*PI)/8))) |
| 12877 | { | ||
| 12878 | 22943 | dir=up; | |
| 12879 | 22943 | } | |
| 12880 |
4/4✓ Branch 0 taken 71427 times.
✓ Branch 1 taken 33717 times.
✓ Branch 2 taken 42639 times.
✓ Branch 3 taken 28788 times.
|
105144 | else if((ddir<=(((7)*PI)/8))&&(ddir>(((5)*PI)/8))) |
| 12881 | { | ||
| 12882 | 42639 | dir=l_up; | |
| 12883 | 42639 | } | |
| 12884 | else | ||
| 12885 | { | ||
| 12886 | 62505 | dir=left; | |
| 12887 | } | ||
| 12888 | } | ||
| 12889 | 371492 | } | |
| 12890 | |||
| 12891 | 533752 | bool eZora::animate(int32_t index) | |
| 12892 | { | ||
| 12893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 533752 times.
|
533752 | if(switch_hooked) return enemy::animate(index); |
| 12894 |
2/2✓ Branch 0 taken 1854 times.
✓ Branch 1 taken 531898 times.
|
533752 | if(dying) |
| 12895 | 1854 | return Dead(index); | |
| 12896 | |||
| 12897 |
2/2✓ Branch 0 taken 528431 times.
✓ Branch 1 taken 3467 times.
|
531898 | if(clk==0) |
| 12898 | { | ||
| 12899 | 3467 | removearmos(x,y,ffcactivated); | |
| 12900 | 3467 | } | |
| 12901 | |||
| 12902 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 531867 times.
|
531898 | if(watch) |
| 12903 | { | ||
| 12904 | 31 | ++clock_zoras[id]; | |
| 12905 | 31 | return true; | |
| 12906 | } | ||
| 12907 | |||
| 12908 |
2/2✓ Branch 0 taken 160375 times.
✓ Branch 1 taken 371492 times.
|
531867 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 12909 | { | ||
| 12910 | 371492 | facehero(); | |
| 12911 | 371492 | } | |
| 12912 | |||
| 12913 |
6/6✓ Branch 0 taken 3208 times.
✓ Branch 1 taken 3082 times.
✓ Branch 2 taken 2586 times.
✓ Branch 3 taken 516940 times.
✓ Branch 4 taken 4111 times.
✓ Branch 5 taken 1940 times.
|
531867 | switch(clk) |
| 12914 | { | ||
| 12915 | case 0: // reposition him | ||
| 12916 | { | ||
| 12917 | 4111 | int32_t t=0; | |
| 12918 | 4111 | int32_t pos2=zc_oldrand()%160 + 16; | |
| 12919 | 4111 | bool placed=false; | |
| 12920 | |||
| 12921 |
4/4✓ Branch 0 taken 4088 times.
✓ Branch 1 taken 19943 times.
✓ Branch 2 taken 12388 times.
✓ Branch 3 taken 3467 times.
|
24031 | while(!placed && t<160) |
| 12922 | { | ||
| 12923 | 12388 | int32_t watertype = iswaterex(tmpscr->data[pos2], currmap, currscr, -1, ((pos2)%16*16), ((pos2)&0xF0), false, true, true, (bool)(editorflags & ENEMY_FLAG7)); | |
| 12924 |
5/6✓ Branch 0 taken 4169 times.
✓ Branch 1 taken 8219 times.
✓ Branch 2 taken 4169 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 322 times.
✓ Branch 5 taken 3444 times.
|
16154 | if(watertype && ((editorflags & ENEMY_FLAG6) || |
| 12925 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4169 times.
|
4169 | ((combobuf[watertype].usrflags&cflag1) && (editorflags & ENEMY_FLAG5)) |
| 12926 |
3/4✓ Branch 0 taken 4169 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3766 times.
✓ Branch 3 taken 3766 times.
|
4169 | || (!(combobuf[watertype].usrflags&cflag1) && !(editorflags & ENEMY_FLAG5))) && (pos2&15)>0 && (pos2&15)<15) |
| 12927 | { | ||
| 12928 | 3444 | x=(pos2&15)<<4; | |
| 12929 | 3444 | y=pos2&0xF0; | |
| 12930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3444 times.
|
3444 | if (!(editorflags & ENEMY_FLAG8)) hp=guysbuf[id&0xFFF].hp; // refill life each time, unless the flag is checked. |
| 12931 | 3444 | hxofs=1000; // avoid hit detection | |
| 12932 | 3444 | stunclk=0; | |
| 12933 | 3444 | placed=true; | |
| 12934 | 3444 | } | |
| 12935 | |||
| 12936 | 19920 | pos2+=19; | |
| 12937 | |||
| 12938 |
2/2✓ Branch 0 taken 17573 times.
✓ Branch 1 taken 2347 times.
|
19920 | if(pos2>=176) |
| 12939 | 2347 | pos2-=160; | |
| 12940 | |||
| 12941 | 19920 | ++t; | |
| 12942 | } | ||
| 12943 | |||
| 12944 |
3/4✓ Branch 0 taken 3444 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3444 times.
|
3467 | if(!placed || whistleclk>=88) // can't place him, he's gone |
| 12945 | 23 | return true; | |
| 12946 | |||
| 12947 | } | ||
| 12948 | 3444 | break; | |
| 12949 | |||
| 12950 | case 35: | ||
| 12951 |
2/2✓ Branch 0 taken 2243 times.
✓ Branch 1 taken 965 times.
|
3208 | if(!get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 12952 | { | ||
| 12953 | 965 | dir=(Hero.y+8<y)?up:down; | |
| 12954 | 965 | } | |
| 12955 | |||
| 12956 | 3208 | hxofs=0; | |
| 12957 | 3208 | break; | |
| 12958 | |||
| 12959 | case 35+19: | ||
| 12960 | 3082 | addEwpn(x,y,z,wpn,2,wdp,dir,getUID(), 0, fakez); | |
| 12961 | 3082 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 12962 | 3082 | break; | |
| 12963 | |||
| 12964 | case 35+66: | ||
| 12965 | 2586 | hxofs=1000; | |
| 12966 | 2586 | break; | |
| 12967 | |||
| 12968 | case 198: | ||
| 12969 | 1940 | clk=-1; | |
| 12970 | 1940 | break; | |
| 12971 | } | ||
| 12972 | |||
| 12973 | 531200 | return enemy::animate(index); | |
| 12974 | 533108 | } | |
| 12975 | |||
| 12976 | 533508 | void eZora::draw(BITMAP *dest) | |
| 12977 | { | ||
| 12978 |
2/2✓ Branch 0 taken 10338 times.
✓ Branch 1 taken 523170 times.
|
533508 | if(clk<3) |
| 12979 | 10338 | return; | |
| 12980 | |||
| 12981 | 523170 | update_enemy_frame(); | |
| 12982 | 523170 | enemy::draw(dest); | |
| 12983 | 533508 | } | |
| 12984 | |||
| 12985 | ✗ | bool eZora::isSubmerged() const | |
| 12986 | { | ||
| 12987 | ✗ | return ( clk < 3 ); | |
| 12988 | } | ||
| 12989 | |||
| 12990 |
4/8✓ Branch 0 taken 23161 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23161 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 23161 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 23161 times.
✗ Branch 7 not taken.
|
69483 | eStalfos::eStalfos(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) |
| 12991 | 46322 | { | |
| 12992 | 23161 | multishot= timer = fired = dashing = 0; | |
| 12993 | 23161 | hashero = false; | |
| 12994 | 23161 | dummy_bool[0]=false; | |
| 12995 | 23161 | shield= (flags&(inv_left | inv_right | inv_back |inv_front)) != 0; | |
| 12996 |
5/6✓ Branch 0 taken 135 times.
✓ Branch 1 taken 23026 times.
✓ Branch 2 taken 135 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 72 times.
✓ Branch 5 taken 63 times.
|
23161 | if(dmisc9==e9tARMOS && zc_oldrand()&1) |
| 12997 | { | ||
| 12998 |
2/4✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✗ Branch 3 not taken.
|
72 | step=zslongToFix(dmisc10*100); |
| 12999 | |||
| 13000 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 60 times.
|
72 | if(anim==aARMOS4) o_tile+=20; |
| 13001 | 72 | } | |
| 13002 | |||
| 13003 |
2/2✓ Branch 0 taken 135 times.
✓ Branch 1 taken 23026 times.
|
23161 | if(flags & guy_fadeflicker) |
| 13004 | { | ||
| 13005 | 135 | clk=0; | |
| 13006 | 135 | superman = 1; | |
| 13007 | 135 | fading=fade_flicker; | |
| 13008 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
|
135 | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; |
| 13009 | 135 | dir=down; | |
| 13010 | |||
| 13011 |
4/6✓ Branch 0 taken 135 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 61 times.
✓ Branch 5 taken 74 times.
|
135 | if(!canmove(down,(zfix)8,spw_none,false)) |
| 13012 |
3/6✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 61 times.
✗ Branch 5 not taken.
|
61 | clk3=int32_t(13.0/step); |
| 13013 | 135 | } | |
| 13014 |
2/2✓ Branch 0 taken 23025 times.
✓ Branch 1 taken 1 times.
|
23026 | else if(flags & guy_fadeinstant) |
| 13015 | { | ||
| 13016 | 1 | clk=0; | |
| 13017 | 1 | } | |
| 13018 | |||
| 13019 |
1/2✓ Branch 0 taken 23161 times.
✗ Branch 1 not taken.
|
23161 | shadowdistance = 0; |
| 13020 | 23161 | clk4 = clk5 = 0; | |
| 13021 | //nets+2380; | ||
| 13022 | 23161 | SIZEflags = d->SIZEflags; | |
| 13023 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
23161 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 13024 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 13025 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 13026 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
23161 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 13027 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
23161 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 13028 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
23161 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 13029 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
23161 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 13030 |
1/2✓ Branch 0 taken 23161 times.
✗ Branch 1 not taken.
|
23161 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 13031 |
1/2✓ Branch 0 taken 23161 times.
✗ Branch 1 not taken.
|
23161 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 13032 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 13033 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
23161 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 13034 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
|
23161 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 13035 | { | ||
| 13036 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 13037 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 13038 | ✗ | } | |
| 13039 | |||
| 13040 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 23161 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
23161 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 13041 | 23161 | } | |
| 13042 | |||
| 13043 | 8871974 | bool eStalfos::animate(int32_t index) | |
| 13044 | { | ||
| 13045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8871974 times.
|
8871974 | if(switch_hooked) return enemy::animate(index); |
| 13046 |
3/4✓ Branch 0 taken 8871832 times.
✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8871832 times.
|
8871974 | if(fallclk||drownclk) |
| 13047 | { | ||
| 13048 | 142 | return enemy::animate(index); | |
| 13049 | } | ||
| 13050 |
2/2✓ Branch 0 taken 194123 times.
✓ Branch 1 taken 8677709 times.
|
8871832 | if(dying) |
| 13051 | { | ||
| 13052 |
2/2✓ Branch 0 taken 194092 times.
✓ Branch 1 taken 31 times.
|
194123 | if(hashero) |
| 13053 | { | ||
| 13054 | 31 | Hero.setEaten(0); | |
| 13055 | 31 | hashero=false; | |
| 13056 | 31 | } | |
| 13057 | |||
| 13058 |
10/14✓ Branch 0 taken 17924 times.
✓ Branch 1 taken 176199 times.
✓ Branch 2 taken 1140 times.
✓ Branch 3 taken 16784 times.
✓ Branch 4 taken 49 times.
✓ Branch 5 taken 1091 times.
✓ Branch 6 taken 49 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 49 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 49 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 49 times.
|
194123 | if(dmisc9==e9tROPE && dmisc2==e2tBOMBCHU && !fired && (hp<=0 && !immortal) && hp>-1000 && wpn>wEnemyWeapons) |
| 13059 | { | ||
| 13060 | 49 | hp=-1000; | |
| 13061 |
5/10✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 49 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 49 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 49 times.
✗ Branch 9 not taken.
|
49 | weapon *ew=new weapon(x,y,z, wpn, 0, dmisc4, dir,-1,getUID(),false); |
| 13062 | 49 | Ewpns.add(ew); | |
| 13063 | 49 | ew->fakez = fakez; | |
| 13064 | |||
| 13065 |
2/4✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
✗ Branch 3 not taken.
|
49 | if(wpn==ewSBomb || wpn==ewBomb) |
| 13066 | { | ||
| 13067 | 49 | ew->step=0; | |
| 13068 | 49 | ew->id=wpn; | |
| 13069 | 49 | ew->misc=50; | |
| 13070 | 49 | ew->clk=48; | |
| 13071 | 49 | } | |
| 13072 | |||
| 13073 | 49 | fired=true; | |
| 13074 | 49 | } | |
| 13075 |
6/6✓ Branch 0 taken 89310 times.
✓ Branch 1 taken 104764 times.
✓ Branch 2 taken 72334 times.
✓ Branch 3 taken 16976 times.
✓ Branch 4 taken 72316 times.
✓ Branch 5 taken 18 times.
|
194074 | else if(wpn && wpn!=ewBrang && dmisc2==e2tFIREOCTO) // Fire Octo |
| 13076 | { | ||
| 13077 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1 times.
|
18 | if(!dummy_bool[0]) |
| 13078 | { | ||
| 13079 | 1 | int32_t wpn2 = wpn+dmisc3; | |
| 13080 | |||
| 13081 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(wpn2 <= wEnemyWeapons || wpn2 >= wMax) |
| 13082 | { | ||
| 13083 | ✗ | wpn2=wpn; | |
| 13084 | ✗ | } | |
| 13085 | |||
| 13086 | 1 | dummy_bool[0]=true; | |
| 13087 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,up, getUID(), 0, fakez); | |
| 13088 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13089 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,down, getUID(), 0, fakez); | |
| 13090 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13091 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,left, getUID(), 0, fakez); | |
| 13092 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13093 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,right, getUID(), 0, fakez); | |
| 13094 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13095 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,l_up, getUID(), 0, fakez); | |
| 13096 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13097 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,r_up, getUID(), 0, fakez); | |
| 13098 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13099 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,l_down, getUID(), 0, fakez); | |
| 13100 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13101 | 1 | addEwpn(x,y,z,wpn2,0,dmisc4,r_down, getUID(), 0, fakez); | |
| 13102 | 1 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 13103 | 1 | sfx(wpnsfx(wpn2),pan(int32_t(x))); | |
| 13104 | 1 | } | |
| 13105 | 18 | } | |
| 13106 | |||
| 13107 | 194123 | KillWeapon(); | |
| 13108 | 194123 | return Dead(index); | |
| 13109 | } | ||
| 13110 | //vire split | ||
| 13111 | //2.10 checked !fslide(), but nothing uses that now anyway. -Z | ||
| 13112 | //Perhaps the problem occurs when vires die because they have < 0 HP, in this check? | ||
| 13113 |
13/14✓ Branch 0 taken 10952 times.
✓ Branch 1 taken 8666757 times.
✓ Branch 2 taken 10952 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 149 times.
✓ Branch 5 taken 10803 times.
✓ Branch 6 taken 779556 times.
✓ Branch 7 taken 7898004 times.
✓ Branch 8 taken 778299 times.
✓ Branch 9 taken 1257 times.
✓ Branch 10 taken 4200 times.
✓ Branch 11 taken 774099 times.
✓ Branch 12 taken 751 times.
✓ Branch 13 taken 3449 times.
|
8677709 | else if(((hp<=0 && !immortal) && dmisc2==e2tSPLIT) || (dmisc2==e2tSPLITHIT && hp>0 && hp<guysbuf[id&0xFFF].hp && !slide() && (sclk&255)<=1)) //Split into enemies |
| 13114 | { | ||
| 13115 | 900 | stop_bgsfx(index); | |
| 13116 | 900 | int32_t kids = guys.Count(); | |
| 13117 | 900 | int32_t id2=dmisc3; | |
| 13118 |
2/2✓ Branch 0 taken 1786 times.
✓ Branch 1 taken 900 times.
|
2686 | for(int32_t i=0; i < dmisc4; i++) |
| 13119 | { | ||
| 13120 | // if (addenemy(x,y,id2+(guysbuf[id2].family==eeKEESE ? 0 : ((i+1)<<12)),-21-(i%4))) | ||
| 13121 |
4/6✓ Branch 0 taken 508 times.
✓ Branch 1 taken 1278 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1278 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1786 times.
|
1786 | if(addenemy(x,y,id2+(guysbuf[id2].family==eeKEESE ? 0 : ((editorflags & ENEMY_FLAG5) ? 0 : (i<<12))),-21-(i%4))) |
| 13122 | 1786 | ((enemy*)guys.spr(kids+i))->count_enemy = false; | |
| 13123 | 1786 | } | |
| 13124 | |||
| 13125 |
1/2✓ Branch 0 taken 900 times.
✗ Branch 1 not taken.
|
900 | if(itemguy) // Hand down the carried item |
| 13126 | { | ||
| 13127 | ✗ | guycarryingitem = guys.Count()-1; | |
| 13128 | ✗ | ((enemy*)guys.spr(guycarryingitem))->itemguy = true; | |
| 13129 | ✗ | itemguy = false; | |
| 13130 | ✗ | } | |
| 13131 | |||
| 13132 |
1/2✓ Branch 0 taken 900 times.
✗ Branch 1 not taken.
|
900 | if(hashero) |
| 13133 | { | ||
| 13134 | ✗ | Hero.setEaten(0); | |
| 13135 | ✗ | hashero=false; | |
| 13136 | ✗ | } | |
| 13137 | |||
| 13138 |
4/4✓ Branch 0 taken 886 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 751 times.
✓ Branch 3 taken 135 times.
|
900 | if(deadsfx > 0 && dmisc2==e2tSPLIT) |
| 13139 | 135 | sfx(deadsfx,pan(int32_t(x))); | |
| 13140 | |||
| 13141 | 900 | return true; | |
| 13142 | } | ||
| 13143 | /* | ||
| 13144 | else if((dmisc2==e2tSPLITHIT && (hp<=0 && !immortal) &&!slide())) //Possible vires fix; or could cause goodness knows what. -Z | ||
| 13145 | { | ||
| 13146 | stop_bgsfx(index); | ||
| 13147 | int32_t kids = guys.Count(); | ||
| 13148 | int32_t id2=dmisc3; | ||
| 13149 | |||
| 13150 | for(int32_t i=0; i < dmisc4; i++) | ||
| 13151 | { | ||
| 13152 | // if (addenemy(x,y,id2+(guysbuf[id2].family==eeKEESE ? 0 : ((i+1)<<12)),-21-(i%4))) | ||
| 13153 | if(addenemy(x,y,id2+(guysbuf[id2].family==eeKEESE ? 0 : (i<<12)),-21-(i%4))) | ||
| 13154 | ((enemy*)guys.spr(kids+i))->count_enemy = false; | ||
| 13155 | } | ||
| 13156 | |||
| 13157 | if(itemguy) // Hand down the carried item | ||
| 13158 | { | ||
| 13159 | guycarryingitem = guys.Count()-1; | ||
| 13160 | ((enemy*)guys.spr(guycarryingitem))->itemguy = true; | ||
| 13161 | itemguy = false; | ||
| 13162 | } | ||
| 13163 | |||
| 13164 | if(hashero) | ||
| 13165 | { | ||
| 13166 | Hero.setEaten(0); | ||
| 13167 | hashero=false; | ||
| 13168 | } | ||
| 13169 | |||
| 13170 | return true; | ||
| 13171 | } | ||
| 13172 | */ | ||
| 13173 |
2/2✓ Branch 0 taken 11022 times.
✓ Branch 1 taken 8665787 times.
|
8676809 | if(fading) |
| 13174 | { | ||
| 13175 |
2/2✓ Branch 0 taken 198 times.
✓ Branch 1 taken 10824 times.
|
11022 | if(++clk4 > 60) |
| 13176 | { | ||
| 13177 | 198 | clk4=0; | |
| 13178 | 198 | superman=0; | |
| 13179 | 198 | fading=0; | |
| 13180 | |||
| 13181 |
4/6✓ Branch 0 taken 135 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 135 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 135 times.
|
198 | if(flags2&cmbflag_armos && z==0 && fakez == 0) |
| 13182 | { | ||
| 13183 | //if a custom size (not 16px by 16px) | ||
| 13184 | |||
| 13185 | //if a custom size (not 16px by 16px) | ||
| 13186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
|
135 | if (ffcactivated) |
| 13187 | ✗ | removearmosffc(ffcactivated-1); | |
| 13188 | else | ||
| 13189 | { | ||
| 13190 |
4/8✓ Branch 0 taken 135 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 135 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 135 times.
|
135 | if (txsz > 1 || tysz > 1 || (SIZEflags&guyflagOVERRIDE_HIT_WIDTH) || (SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) )//remove more than one combo based on enemy size |
| 13191 | { | ||
| 13192 | //zprint("spawn big enemy from armos\n"); | ||
| 13193 | //if removing a block, then adjust y by -1 as the enemy spawns at y+1 | ||
| 13194 | ✗ | for(int32_t dx = 0; dx < tysz; dx ++) | |
| 13195 | { | ||
| 13196 | ✗ | for(int32_t dy = 0; dy < tysz; dy++) | |
| 13197 | { | ||
| 13198 | ✗ | removearmos((int32_t)x+(dx*16),(int32_t)y+(dy*16)+1); | |
| 13199 | ✗ | did_armos = false; | |
| 13200 | ✗ | } | |
| 13201 | ✗ | removearmos((int32_t)x+(dx*16), (int32_t)y+((tysz-1)*16)+1); | |
| 13202 | ✗ | did_armos = false; | |
| 13203 | ✗ | } | |
| 13204 | ✗ | for(int32_t dy = 0; dy < tysz; dy ++) | |
| 13205 | { | ||
| 13206 | ✗ | removearmos((int32_t)x+((txsz-1)*16), (int32_t)y+(dy*16)+1); | |
| 13207 | ✗ | did_armos = false; | |
| 13208 | ✗ | } | |
| 13209 | ✗ | removearmos((int32_t)x+((txsz-1)*16), (int32_t)y+((tysz-1)*16)+1); | |
| 13210 | ✗ | } | |
| 13211 | 135 | else removearmos(x,y); | |
| 13212 | } | ||
| 13213 | /* | ||
| 13214 | if (txsz > 1 || tysz > 1 || (SIZEflags&guyflagOVERRIDE_HIT_WIDTH) || (SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) )//remove more than one combo based on enemy size | ||
| 13215 | { | ||
| 13216 | //if removing a block, then adjust y by -1 as the enemy spawns at y+1 | ||
| 13217 | for(int32_t dx = 0; dx < hxsz; dx += 16) | ||
| 13218 | { | ||
| 13219 | for(int32_t dy = 0; dy < hysz; dy += 16) | ||
| 13220 | { | ||
| 13221 | removearmos((int32_t)x+dx+hxofs,(int32_t)y+dy+hyofs+1,ffcactivated); | ||
| 13222 | did_armos = false; | ||
| 13223 | } | ||
| 13224 | removearmos((int32_t)x+dx+hxofs, (int32_t)y+hyofs+(hysz-1)-1,ffcactivated); | ||
| 13225 | did_armos = false; | ||
| 13226 | } | ||
| 13227 | for(int32_t dy = 0; dy < hysz; dy += 16) | ||
| 13228 | { | ||
| 13229 | removearmos((int32_t)x+hxofs+(hxsz-1), (int32_t)y+dy+hyofs-1,ffcactivated); | ||
| 13230 | did_armos = false; | ||
| 13231 | } | ||
| 13232 | removearmos((int32_t)x+hxofs+(hxsz-1), (int32_t)y+hyofs+(hysz-1)-1,ffcactivated); | ||
| 13233 | } | ||
| 13234 | else removearmos(x,y,ffcactivated); | ||
| 13235 | */ | ||
| 13236 | |||
| 13237 | 135 | } | |
| 13238 | |||
| 13239 | 198 | clk2=0; | |
| 13240 | |||
| 13241 | 198 | newdir(); | |
| 13242 | 198 | } | |
| 13243 | 10824 | else return enemy::animate(index); | |
| 13244 | 198 | } | |
| 13245 |
6/8✓ Branch 0 taken 30924 times.
✓ Branch 1 taken 8634863 times.
✓ Branch 2 taken 30924 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 30924 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 28959 times.
✓ Branch 7 taken 1965 times.
|
8665787 | else if(flags2&cmbflag_armos && z==0 && fakez == 0 && clk==0) |
| 13246 | 1965 | removearmos(x,y,ffcactivated); | |
| 13247 | |||
| 13248 | |||
| 13249 |
2/2✓ Branch 0 taken 2540 times.
✓ Branch 1 taken 8663445 times.
|
8665985 | if(hashero) |
| 13250 | { | ||
| 13251 | 2540 | Hero.setX(x); | |
| 13252 | 2540 | Hero.setY(y); | |
| 13253 | 2540 | ++clk2; | |
| 13254 | |||
| 13255 |
4/4✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 1513 times.
✓ Branch 2 taken 2489 times.
✓ Branch 3 taken 51 times.
|
2540 | if(clk2==(dmisc8==0 ? 95 : dmisc8)) |
| 13256 | { | ||
| 13257 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
51 | switch(dmisc7) |
| 13258 | { | ||
| 13259 | case e7tEATITEMS: | ||
| 13260 | { | ||
| 13261 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 1 times.
|
257 | for(int32_t i=0; i<MAXITEMS; i++) |
| 13262 | { | ||
| 13263 |
2/2✓ Branch 0 taken 255 times.
✓ Branch 1 taken 1 times.
|
256 | if(itemsbuf[i].flags&ITEM_EDIBLE) |
| 13264 | 1 | game->set_item(i, false); | |
| 13265 | 256 | } | |
| 13266 | |||
| 13267 | 1 | break; | |
| 13268 | } | ||
| 13269 | |||
| 13270 | case e7tEATMAGIC: | ||
| 13271 | ✗ | game->change_dmagic(-1*game->get_magicdrainrate()); | |
| 13272 | ✗ | break; | |
| 13273 | |||
| 13274 | case e7tEATRUPEES: | ||
| 13275 | ✗ | game->change_drupy(-1); | |
| 13276 | ✗ | break; | |
| 13277 | } | ||
| 13278 | |||
| 13279 | 51 | clk2=0; | |
| 13280 | 51 | } | |
| 13281 | |||
| 13282 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 2335 times.
|
2540 | if((clk&0x18)==8) // stop its animation on the middle frame |
| 13283 | 2335 | --clk; | |
| 13284 | 2540 | } | |
| 13285 |
4/4✓ Branch 0 taken 676625 times.
✓ Branch 1 taken 7986820 times.
✓ Branch 2 taken 393431 times.
✓ Branch 3 taken 283194 times.
|
8663445 | else if(!(wpn==ewBrang && WeaponOut())) //WeaponOut uses misc |
| 13286 | { | ||
| 13287 | // Movement engine | ||
| 13288 |
4/6✓ Branch 0 taken 453967 times.
✓ Branch 1 taken 7926284 times.
✓ Branch 2 taken 2248 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7924036 times.
✗ Branch 5 not taken.
|
8380251 | if(clk>=0) switch(id>>12) |
| 13289 | { | ||
| 13290 | case 0: // Normal movement | ||
| 13291 | |||
| 13292 | /* | ||
| 13293 | if((dmisc9==e9tLEEVER || dmisc9==e9tZ3LEEVER) && !slide()) //Leever | ||
| 13294 | { | ||
| 13295 | // Overloading clk4 (Tribble clock) here... | ||
| 13296 | step=17/100.0; | ||
| 13297 | if(clk4<32) misc=1; | ||
| 13298 | else if(clk4<48) misc=2; | ||
| 13299 | else if(clk4<300) { misc=3; step = dstep/100.0; } | ||
| 13300 | else if(clk4<316) misc=2; | ||
| 13301 | else if(clk4<412) misc=1; | ||
| 13302 | else if(clk4<540) { misc=0; step=0; } | ||
| 13303 | else clk4=0; | ||
| 13304 | if(clk4==48) clk=0; | ||
| 13305 | hxofs=(misc>=2)?0:1000; | ||
| 13306 | if (dmisc9==e9tLEEVER) | ||
| 13307 | variable_walk(rate, homing, 0); | ||
| 13308 | else | ||
| 13309 | variable_walk_8(rate, homing, 4, 0); | ||
| 13310 | break; | ||
| 13311 | } | ||
| 13312 | */ | ||
| 13313 |
4/4✓ Branch 0 taken 7738675 times.
✓ Branch 1 taken 185361 times.
✓ Branch 2 taken 268937 times.
✓ Branch 3 taken 7469738 times.
|
7924036 | if(dmisc9==e9tVIRE || dmisc9==e9tPOLSVOICE) //Vire |
| 13314 | { | ||
| 13315 | 454298 | vire_hop(); | |
| 13316 | 454298 | break; | |
| 13317 | } | ||
| 13318 |
2/2✓ Branch 0 taken 549014 times.
✓ Branch 1 taken 6920724 times.
|
7469738 | else if(dmisc9==e9tROPE) //Rope charge |
| 13319 | { | ||
| 13320 |
9/10✓ Branch 0 taken 531592 times.
✓ Branch 1 taken 17422 times.
✓ Branch 2 taken 76944 times.
✓ Branch 3 taken 454648 times.
✓ Branch 4 taken 70223 times.
✓ Branch 5 taken 6721 times.
✓ Branch 6 taken 69507 times.
✓ Branch 7 taken 716 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 69507 times.
|
549014 | if(!fired && dashing && !stunclk && !watch && !frozenclock) |
| 13321 | { | ||
| 13322 |
5/6✓ Branch 0 taken 2372 times.
✓ Branch 1 taken 67135 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 2357 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 15 times.
|
69507 | if(dmisc2==e2tBOMBCHU && HeroInRange(16) && wpn+dmisc3 > wEnemyWeapons) //Bombchu |
| 13323 | { | ||
| 13324 | |||
| 13325 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1 times.
|
15 | if ( get_bit(quest_rules,qr_BOMBCHUSUPERBOMB) ) |
| 13326 | { | ||
| 13327 | 14 | hp=-1000; | |
| 13328 | |||
| 13329 |
2/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
|
14 | if(wpn+dmisc3 > wEnemyWeapons && wpn+dmisc3 < wMax) |
| 13330 | { | ||
| 13331 |
5/10✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
|
14 | weapon *ew=new weapon(x,y,z, wpn+dmisc3, 0, dmisc4, dir,-1,getUID()); |
| 13332 | 14 | Ewpns.add(ew); | |
| 13333 | 14 | ew->fakez = fakez; | |
| 13334 | |||
| 13335 |
2/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
|
14 | if(wpn==ewSBomb || wpn==ewBomb) |
| 13336 | { | ||
| 13337 | 14 | ew->step=0; | |
| 13338 | 14 | ew->id=wpn+dmisc3; | |
| 13339 | 14 | ew->misc=50; | |
| 13340 | 14 | ew->clk=48; | |
| 13341 | 14 | } | |
| 13342 | |||
| 13343 | 14 | fired=true; | |
| 13344 | 14 | } | |
| 13345 | else | ||
| 13346 | { | ||
| 13347 | ✗ | weapon *ew=new weapon(x,y,z, wpn, 0, dmisc4, dir,-1,getUID()); | |
| 13348 | ✗ | Ewpns.add(ew); | |
| 13349 | ✗ | ew->fakez = fakez; | |
| 13350 | |||
| 13351 | ✗ | if(wpn==ewSBomb || wpn==ewBomb) | |
| 13352 | { | ||
| 13353 | ✗ | ew->step=0; | |
| 13354 | ✗ | ew->id=wpn; | |
| 13355 | ✗ | ew->misc=50; | |
| 13356 | ✗ | ew->clk=48; | |
| 13357 | ✗ | } | |
| 13358 | |||
| 13359 | ✗ | fired=true; | |
| 13360 | } | ||
| 13361 | 14 | } | |
| 13362 | |||
| 13363 | else | ||
| 13364 | { | ||
| 13365 | 1 | hp=-1000; | |
| 13366 | |||
| 13367 | int32_t wpn2; | ||
| 13368 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(wpn+dmisc3 > wEnemyWeapons && wpn+dmisc3 < wMax) |
| 13369 | 1 | wpn2=wpn; | |
| 13370 | else | ||
| 13371 | ✗ | wpn2=wpn; | |
| 13372 | |||
| 13373 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
1 | weapon *ew=new weapon(x,y,z, wpn2, 0, dmisc4, dir,-1,getUID()); |
| 13374 | 1 | Ewpns.add(ew); | |
| 13375 | 1 | ew->fakez = fakez; | |
| 13376 | |||
| 13377 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | if(wpn2==ewSBomb || wpn2==ewBomb) |
| 13378 | { | ||
| 13379 | 1 | ew->step=0; | |
| 13380 | 1 | ew->id=wpn2; | |
| 13381 | 1 | ew->misc=50; | |
| 13382 | 1 | ew->clk=48; | |
| 13383 | 1 | } | |
| 13384 | |||
| 13385 | 1 | fired=true; | |
| 13386 | } | ||
| 13387 | 15 | } | |
| 13388 | 69507 | } | |
| 13389 | |||
| 13390 | 549014 | charge_attack(); | |
| 13391 | 549014 | break; | |
| 13392 | } | ||
| 13393 | /* | ||
| 13394 | * Boomerang-throwers have a halt count of 1 | ||
| 13395 | * Zols have a halt count of (zc_oldrand()&7)<<4 | ||
| 13396 | * Gels have a halt count of ((zc_oldrand()&7)<<3)+2 | ||
| 13397 | * Everything else has 48 | ||
| 13398 | */ | ||
| 13399 | else | ||
| 13400 | { | ||
| 13401 |
2/2✓ Branch 0 taken 364907 times.
✓ Branch 1 taken 6555817 times.
|
6920724 | if(wpn==ewBrang) // Goriya |
| 13402 | { | ||
| 13403 | 364907 | halting_walk(rate,homing,0,hrate, 1); | |
| 13404 | 364907 | } | |
| 13405 |
4/4✓ Branch 0 taken 6524758 times.
✓ Branch 1 taken 31059 times.
✓ Branch 2 taken 2535520 times.
✓ Branch 3 taken 3989238 times.
|
6555817 | else if(dmisc9==e9tNORMAL && wpn==0) |
| 13406 | { | ||
| 13407 |
2/2✓ Branch 0 taken 551326 times.
✓ Branch 1 taken 3437912 times.
|
3989238 | if(dmisc2==e2tSPLITHIT) // Zol |
| 13408 | { | ||
| 13409 | 551326 | halting_walk(rate,homing,0,hrate,(zc_oldrand()&7)<<4); | |
| 13410 | 551326 | } | |
| 13411 |
4/4✓ Branch 0 taken 1118569 times.
✓ Branch 1 taken 2319343 times.
✓ Branch 2 taken 1026079 times.
✓ Branch 3 taken 92490 times.
|
3437912 | else if(frate<=8 && starting_hp==1) // Gel |
| 13412 | { | ||
| 13413 | 92490 | halting_walk(rate,homing,0,hrate,((zc_oldrand()&7)<<3)+2); | |
| 13414 | 92490 | } | |
| 13415 | else // Other | ||
| 13416 | { | ||
| 13417 | 3345422 | halting_walk(rate,homing,0,hrate, 48); | |
| 13418 | } | ||
| 13419 | 3989238 | } | |
| 13420 | else // Other | ||
| 13421 | { | ||
| 13422 | 2566579 | halting_walk(rate,homing,0,hrate, 48); | |
| 13423 | } | ||
| 13424 | } | ||
| 13425 | |||
| 13426 | //if not in midair, and Hero's swinging sword is nearby, jump. | ||
| 13427 | /*if (dmisc9==e9tZ3STALFOS && z==0 && (!(isSideViewGravity()) || !_walkflag(x,y+16,0)) | ||
| 13428 | && Hero.getAttackClk()==5 && Hero.getAttack()==wSword && distance(x,y,Hero.getX(),Hero.getY())<32) | ||
| 13429 | { | ||
| 13430 | facehero(false); | ||
| 13431 | sclk=16+((dir^1)<<8); | ||
| 13432 | fall=-FEATHERJUMP; | ||
| 13433 | sfx(WAV_ZN1JUMP,pan(int32_t(x))); | ||
| 13434 | }*/ | ||
| 13435 | 6920724 | break; | |
| 13436 | |||
| 13437 | // Following cases are for just after creation-by-splitting. | ||
| 13438 | case 1: | ||
| 13439 |
2/2✓ Branch 0 taken 1689 times.
✓ Branch 1 taken 559 times.
|
2248 | if(misc==1) |
| 13440 | { | ||
| 13441 | 559 | dir=up; | |
| 13442 | 559 | step=8; | |
| 13443 | 559 | } | |
| 13444 | |||
| 13445 |
2/2✓ Branch 0 taken 538 times.
✓ Branch 1 taken 1710 times.
|
2248 | if(misc<=2) |
| 13446 | { | ||
| 13447 | 1710 | move(step); | |
| 13448 | |||
| 13449 |
2/2✓ Branch 0 taken 1379 times.
✓ Branch 1 taken 331 times.
|
1710 | if(!canmove(dir,(zfix)0,0,false)) |
| 13450 | 331 | dir=down; | |
| 13451 | 1710 | } | |
| 13452 | |||
| 13453 |
2/2✓ Branch 0 taken 1710 times.
✓ Branch 1 taken 538 times.
|
2248 | if(misc==3) |
| 13454 | { | ||
| 13455 |
2/2✓ Branch 0 taken 199 times.
✓ Branch 1 taken 339 times.
|
538 | if(canmove(right,(zfix)16,0,false)) |
| 13456 | 339 | x+=16; | |
| 13457 | 538 | } | |
| 13458 | |||
| 13459 | 2248 | ++misc; | |
| 13460 | 2248 | break; | |
| 13461 | |||
| 13462 | case 2: | ||
| 13463 | ✗ | if(misc==1) | |
| 13464 | { | ||
| 13465 | ✗ | dir=down; | |
| 13466 | ✗ | step=8; | |
| 13467 | ✗ | } | |
| 13468 | |||
| 13469 | ✗ | if(misc<=2) | |
| 13470 | { | ||
| 13471 | ✗ | move(step); | |
| 13472 | /* | ||
| 13473 | if(!canmove(dir,(zfix)0,0,false)) | ||
| 13474 | dir=up; | ||
| 13475 | */ | ||
| 13476 | ✗ | } | |
| 13477 | |||
| 13478 | ✗ | if(misc==3) | |
| 13479 | { | ||
| 13480 | ✗ | if(canmove(left,(zfix)16,0,false)) | |
| 13481 | ✗ | x-=16; | |
| 13482 | ✗ | } | |
| 13483 | |||
| 13484 | ✗ | ++misc; | |
| 13485 | ✗ | break; | |
| 13486 | |||
| 13487 | default: | ||
| 13488 | ✗ | if(misc==1) | |
| 13489 | { | ||
| 13490 | ✗ | dir=(zc_oldrand()%4); | |
| 13491 | ✗ | step=8; | |
| 13492 | ✗ | } | |
| 13493 | |||
| 13494 | ✗ | if(misc<=2) | |
| 13495 | { | ||
| 13496 | ✗ | move(step); | |
| 13497 | |||
| 13498 | ✗ | if(!canmove(dir,(zfix)0,0,false)) | |
| 13499 | ✗ | dir=dir^1; | |
| 13500 | ✗ | } | |
| 13501 | |||
| 13502 | ✗ | if(misc==3) | |
| 13503 | { | ||
| 13504 | ✗ | if(dir >= left && canmove(dir,(zfix)16,0,false)) | |
| 13505 | ✗ | x+=(dir==left ? -16 : 16); | |
| 13506 | ✗ | } | |
| 13507 | |||
| 13508 | ✗ | ++misc; | |
| 13509 | ✗ | break; | |
| 13510 | 7926284 | } | |
| 13511 | |||
| 13512 |
4/4✓ Branch 0 taken 16116 times.
✓ Branch 1 taken 8364135 times.
✓ Branch 2 taken 15578 times.
✓ Branch 3 taken 538 times.
|
8380251 | if(id>>12 && misc>=4) //recently spawned by a split enemy |
| 13513 | { | ||
| 13514 | 538 | id&=0xFFF; | |
| 13515 | 538 | step = zslongToFix(dstep*100); | |
| 13516 | |||
| 13517 |
1/2✓ Branch 0 taken 538 times.
✗ Branch 1 not taken.
|
538 | if(x<32) x=32; |
| 13518 | |||
| 13519 |
2/2✓ Branch 0 taken 527 times.
✓ Branch 1 taken 11 times.
|
538 | if(x>208) x=208; |
| 13520 | |||
| 13521 |
2/2✓ Branch 0 taken 520 times.
✓ Branch 1 taken 18 times.
|
538 | if(y<32) y=32; |
| 13522 | |||
| 13523 |
2/2✓ Branch 0 taken 533 times.
✓ Branch 1 taken 5 times.
|
538 | if(y>128) y=128; |
| 13524 | |||
| 13525 | 538 | misc=3; | |
| 13526 | 538 | } | |
| 13527 | 8380251 | } | |
| 13528 | else | ||
| 13529 | { | ||
| 13530 | //sfx(wpnsfx(wpn),pan(int32_t(x))); | ||
| 13531 |
1/2✓ Branch 0 taken 283194 times.
✗ Branch 1 not taken.
|
283194 | if(clk2>2) clk2--; |
| 13532 | } | ||
| 13533 | |||
| 13534 | // Fire Zol | ||
| 13535 |
7/8✓ Branch 0 taken 3516357 times.
✓ Branch 1 taken 5149628 times.
✓ Branch 2 taken 6634 times.
✓ Branch 3 taken 3509723 times.
✓ Branch 4 taken 47 times.
✓ Branch 5 taken 6587 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 47 times.
|
8665985 | if(wpn && dmisc1==e1tEACHTILE && clk2==1 && !hclk) |
| 13536 | { | ||
| 13537 | 47 | addEwpn(x,y,z,wpn,0,wdp,dir, getUID(), 0, fakez); | |
| 13538 | 47 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 13539 | |||
| 13540 | 47 | int32_t i=Ewpns.Count()-1; | |
| 13541 | 47 | weapon *ew = (weapon*)(Ewpns.spr(i)); | |
| 13542 | |||
| 13543 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
47 | if(wpn==ewFIRETRAIL && wpnsbuf[ewFIRETRAIL].frames>1) |
| 13544 | { | ||
| 13545 | ✗ | ew->aframe=zc_oldrand()%wpnsbuf[ewFIRETRAIL].frames; | |
| 13546 | ✗ | if ( ew->do_animation ) ew->tile+=ew->aframe; | |
| 13547 | ✗ | } | |
| 13548 | 47 | } | |
| 13549 | // Goriya | ||
| 13550 |
14/16✓ Branch 0 taken 676625 times.
✓ Branch 1 taken 7989313 times.
✓ Branch 2 taken 308336 times.
✓ Branch 3 taken 368289 times.
✓ Branch 4 taken 301226 times.
✓ Branch 5 taken 7110 times.
✓ Branch 6 taken 277971 times.
✓ Branch 7 taken 23255 times.
✓ Branch 8 taken 277971 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 275265 times.
✓ Branch 11 taken 2706 times.
✓ Branch 12 taken 275265 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 271194 times.
✓ Branch 15 taken 4071 times.
|
8665938 | else if(wpn==ewBrang && clk2==1 && sclk==0 && !stunclk && !frozenclock && !watch && wpn && !WeaponOut()) |
| 13551 | { | ||
| 13552 | 4071 | misc=index+100; | |
| 13553 |
7/14✓ Branch 0 taken 4071 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4071 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4071 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4071 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4071 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4071 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4071 times.
✗ Branch 13 not taken.
|
4071 | Ewpns.add(new weapon(x,y-fakez,z,wpn,misc,wdp,dir, -1,getUID(),false)); |
| 13554 | 4071 | ((weapon*)Ewpns.spr(Ewpns.Count()-1))->dummy_bool[0]=false; | |
| 13555 | |||
| 13556 |
2/2✓ Branch 0 taken 3916 times.
✓ Branch 1 taken 155 times.
|
4071 | if(dmisc1==2) |
| 13557 | { | ||
| 13558 | 155 | int32_t ndir=dir; | |
| 13559 | |||
| 13560 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 151 times.
|
155 | if(Hero.x-x==0) |
| 13561 | { | ||
| 13562 | 4 | ndir=(Hero.y+8<y)?up:down; | |
| 13563 | 4 | } | |
| 13564 | else //turn to face Hero | ||
| 13565 | { | ||
| 13566 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 13567 | 151 | double ddir=atan2_MSVC2022_FIX(double(y-(Hero.y)),double(Hero.x-x)); | |
| 13568 | |||
| 13569 |
4/4✓ Branch 0 taken 26 times.
✓ Branch 1 taken 125 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 9 times.
|
151 | if((ddir<=(((-2)*PI)/8))&&(ddir>(((-6)*PI)/8))) |
| 13570 | { | ||
| 13571 | 9 | ndir=down; | |
| 13572 | 9 | } | |
| 13573 |
4/4✓ Branch 0 taken 58 times.
✓ Branch 1 taken 84 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 41 times.
|
142 | else if((ddir<=(((2)*PI)/8))&&(ddir>(((-2)*PI)/8))) |
| 13574 | { | ||
| 13575 | 41 | ndir=right; | |
| 13576 | 41 | } | |
| 13577 |
4/4✓ Branch 0 taken 50 times.
✓ Branch 1 taken 51 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 33 times.
|
101 | else if((ddir<=(((6)*PI)/8))&&(ddir>(((2)*PI)/8))) |
| 13578 | { | ||
| 13579 | 33 | ndir=up; | |
| 13580 | 33 | } | |
| 13581 | else | ||
| 13582 | { | ||
| 13583 | 68 | ndir=left; | |
| 13584 | } | ||
| 13585 | } | ||
| 13586 | |||
| 13587 | 155 | ((weapon*)Ewpns.spr(Ewpns.Count()-1))->dummy_bool[0]=true; | |
| 13588 | |||
| 13589 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 153 times.
|
155 | if(canmove(ndir,false)) |
| 13590 | { | ||
| 13591 | 153 | dir=ndir; | |
| 13592 | 153 | } | |
| 13593 | 155 | } | |
| 13594 | 4071 | } | |
| 13595 |
15/16✓ Branch 0 taken 8627990 times.
✓ Branch 1 taken 33877 times.
✓ Branch 2 taken 118588 times.
✓ Branch 3 taken 8543279 times.
✓ Branch 4 taken 104007 times.
✓ Branch 5 taken 14581 times.
✓ Branch 6 taken 89300 times.
✓ Branch 7 taken 14707 times.
✓ Branch 8 taken 88643 times.
✓ Branch 9 taken 657 times.
✓ Branch 10 taken 80765 times.
✓ Branch 11 taken 7878 times.
✓ Branch 12 taken 80765 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 944 times.
✓ Branch 15 taken 79821 times.
|
8661867 | else if((clk2==16 || dmisc1==e1tCONSTANT) && dmisc1!=e1tEACHTILE && wpn && wpn!=ewBrang && sclk==0 && !stunclk && !frozenclock && !watch) |
| 13596 |
3/3✓ Branch 0 taken 14755 times.
✓ Branch 1 taken 64165 times.
✓ Branch 2 taken 901 times.
|
79821 | switch(dmisc1) |
| 13597 | { | ||
| 13598 | case e1tCONSTANT: //Deathnut | ||
| 13599 | { | ||
| 13600 | // Overloading clk5 (Like Like clock) to avoid making another clock just for this attack... | ||
| 13601 |
2/2✓ Branch 0 taken 62822 times.
✓ Branch 1 taken 1343 times.
|
64165 | if(clk5>64) |
| 13602 | { | ||
| 13603 | 1343 | clk5=0; | |
| 13604 | 1343 | fired=false; | |
| 13605 | 1343 | } | |
| 13606 | |||
| 13607 | 64165 | clk5+=(zc_oldrand()&3); | |
| 13608 | |||
| 13609 |
4/4✓ Branch 0 taken 39489 times.
✓ Branch 1 taken 24676 times.
✓ Branch 2 taken 13354 times.
✓ Branch 3 taken 26135 times.
|
64165 | if((clk5>24)&&(clk5<52)) |
| 13610 | { | ||
| 13611 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26135 times.
|
26135 | if ( do_animation )tile+=20; //firing |
| 13612 | |||
| 13613 |
4/4✓ Branch 0 taken 14252 times.
✓ Branch 1 taken 11883 times.
✓ Branch 2 taken 12803 times.
✓ Branch 3 taken 1449 times.
|
26135 | if(!fired&&(clk5>=38)) |
| 13614 | { | ||
| 13615 |
5/10✓ Branch 0 taken 1449 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1449 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1449 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1449 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1449 times.
✗ Branch 9 not taken.
|
1449 | Ewpns.add(new weapon(x,y,z, wpn, 0, wdp, dir, -1,getUID(),false)); |
| 13616 | 1449 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 13617 | 1449 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 13618 | 1449 | fired=true; | |
| 13619 | 1449 | } | |
| 13620 | 26135 | } | |
| 13621 | |||
| 13622 | 64165 | break; | |
| 13623 | } | ||
| 13624 | |||
| 13625 | case e1tFIREOCTO: //Fire Octo | ||
| 13626 | 901 | timer=zc_oldrand()%50+50; | |
| 13627 | 901 | break; | |
| 13628 | |||
| 13629 | default: | ||
| 13630 | 14755 | FireWeapon(); | |
| 13631 | 14755 | break; | |
| 13632 | 79821 | } | |
| 13633 | |||
| 13634 | /* Fire again if: | ||
| 13635 | * - clk2 about to run out | ||
| 13636 | * - not already double-firing (dmisc1 is 1) | ||
| 13637 | * - not carrying Hero | ||
| 13638 | * - one in 0xF chance | ||
| 13639 | */ | ||
| 13640 |
8/10✓ Branch 0 taken 340119 times.
✓ Branch 1 taken 8325866 times.
✓ Branch 2 taken 3015 times.
✓ Branch 3 taken 337104 times.
✓ Branch 4 taken 3015 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3015 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 194 times.
✓ Branch 9 taken 2821 times.
|
8665985 | if(clk2==1 && (multishot < dmisc6) && dmisc1 != e1tEACHTILE && !hashero && !(zc_oldrand()&15)) |
| 13641 | { | ||
| 13642 | #if 1 | ||
| 13643 | 194 | newdir(rate, homing, grumble); | |
| 13644 | #else | ||
| 13645 | dir^=2; | ||
| 13646 | #endif | ||
| 13647 | 194 | clk2=28; | |
| 13648 | 194 | ++multishot; | |
| 13649 | 194 | } | |
| 13650 | |||
| 13651 |
2/2✓ Branch 0 taken 2124710 times.
✓ Branch 1 taken 6541275 times.
|
8665985 | if(clk2==0) |
| 13652 | { | ||
| 13653 | 6541275 | multishot = 0; | |
| 13654 | 6541275 | } | |
| 13655 | |||
| 13656 |
2/2✓ Branch 0 taken 8601868 times.
✓ Branch 1 taken 64117 times.
|
8665985 | if(timer) //Fire Octo |
| 13657 | { | ||
| 13658 | 64117 | clk2=15; //this keeps the octo in place until he's done firing | |
| 13659 | |||
| 13660 |
2/2✓ Branch 0 taken 48413 times.
✓ Branch 1 taken 15704 times.
|
64117 | if(!(timer%4)) |
| 13661 | { | ||
| 13662 | 15704 | FireBreath(false); | |
| 13663 | 15704 | } | |
| 13664 | |||
| 13665 | 64117 | --timer; | |
| 13666 | 64117 | } | |
| 13667 | |||
| 13668 |
2/2✓ Branch 0 taken 8489156 times.
✓ Branch 1 taken 176829 times.
|
8665985 | if(dmisc2==e2tTRIBBLE) |
| 13669 | 176829 | ++clk4; | |
| 13670 | |||
| 13671 |
7/10✓ Branch 0 taken 2240 times.
✓ Branch 1 taken 8663745 times.
✓ Branch 2 taken 607 times.
✓ Branch 3 taken 8665378 times.
✓ Branch 4 taken 607 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 607 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 607 times.
|
8665985 | if(clk4==(dmisc5 ? dmisc5 : 256) && (dmisc2==e2tTRIBBLE) && dmisc3 && dmisc4) |
| 13672 | { | ||
| 13673 | 607 | int32_t kids = guys.Count(); | |
| 13674 | 607 | int32_t id2=dmisc3; | |
| 13675 | |||
| 13676 |
2/2✓ Branch 0 taken 607 times.
✓ Branch 1 taken 607 times.
|
1214 | for(int32_t i=0; i<dmisc4; i++) |
| 13677 | { | ||
| 13678 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 607 times.
|
607 | if(addenemy(x,y,id2,-24)) |
| 13679 | { | ||
| 13680 |
1/2✓ Branch 0 taken 607 times.
✗ Branch 1 not taken.
|
607 | if(itemguy) // Hand down the carried item |
| 13681 | { | ||
| 13682 | ✗ | guycarryingitem = guys.Count()-1; | |
| 13683 | ✗ | ((enemy*)guys.spr(guycarryingitem))->itemguy = true; | |
| 13684 | ✗ | itemguy = false; | |
| 13685 | ✗ | } | |
| 13686 | |||
| 13687 | 607 | ((enemy*)guys.spr(kids+i))->count_enemy = false; | |
| 13688 | 607 | } | |
| 13689 | 607 | } | |
| 13690 | |||
| 13691 |
1/2✓ Branch 0 taken 607 times.
✗ Branch 1 not taken.
|
607 | if(hashero) |
| 13692 | { | ||
| 13693 | ✗ | Hero.setEaten(0); | |
| 13694 | ✗ | hashero=false; | |
| 13695 | ✗ | } | |
| 13696 | |||
| 13697 | 607 | stop_bgsfx(index); | |
| 13698 | 607 | return true; | |
| 13699 | } | ||
| 13700 | |||
| 13701 | 8665378 | return enemy::animate(index); | |
| 13702 | 8871974 | } | |
| 13703 | |||
| 13704 | 9181975 | void eStalfos::draw(BITMAP *dest) | |
| 13705 | { | ||
| 13706 | /*if ((dmisc9==e9tLEEVER || dmisc9==e9tZ3LEEVER) && misc<=0) //Submerged | ||
| 13707 | { | ||
| 13708 | clk4--; //Kludge | ||
| 13709 | return; | ||
| 13710 | }*/ | ||
| 13711 | |||
| 13712 | /*if ((dmisc9==e9tLEEVER || dmisc9==e9tZ3LEEVER) && misc>1) | ||
| 13713 | { | ||
| 13714 | cs = dcset; | ||
| 13715 | }*/ | ||
| 13716 | 9181975 | update_enemy_frame(); | |
| 13717 | |||
| 13718 |
7/8✓ Branch 0 taken 9181833 times.
✓ Branch 1 taken 142 times.
✓ Branch 2 taken 9181833 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35975 times.
✓ Branch 5 taken 9145858 times.
✓ Branch 6 taken 33085 times.
✓ Branch 7 taken 2890 times.
|
9181975 | if(!fallclk&&!drownclk&&(dmisc2==e2tBOMBCHU)&&dashing) |
| 13719 | { | ||
| 13720 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2890 times.
|
2890 | if ( do_animation )tile+=20; |
| 13721 | 2890 | } | |
| 13722 | |||
| 13723 | 9181975 | enemy::draw(dest); | |
| 13724 | 9181975 | } | |
| 13725 | |||
| 13726 | 1969465 | void eStalfos::drawshadow(BITMAP *dest, bool translucent) | |
| 13727 | { | ||
| 13728 | 1969465 | int32_t tempy=yofs; | |
| 13729 | |||
| 13730 | /* | ||
| 13731 | if (clk6 && dir>=left && !get_bit(quest_rules,qr_ENEMIESZAXIS)) { | ||
| 13732 | flip = 0; | ||
| 13733 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? | ||
| 13734 | (clk/(frate/4)):((clk>=(frate>>1))?1:0); | ||
| 13735 | shadowtile = wpnsbuf[spr_shadow].tile+f2; | ||
| 13736 | yofs+=(((int32_t)y+17)&0xF0)-y; | ||
| 13737 | yofs+=8; | ||
| 13738 | } | ||
| 13739 | */ | ||
| 13740 |
3/4✓ Branch 0 taken 1888692 times.
✓ Branch 1 taken 80773 times.
✓ Branch 2 taken 1969465 times.
✗ Branch 3 not taken.
|
1969465 | if((dmisc9 == e9tPOLSVOICE || dmisc9==e9tVIRE) && !get_bit(quest_rules,qr_ENEMIESZAXIS)) |
| 13741 | { | ||
| 13742 | ✗ | flip = 0; | |
| 13743 | ✗ | int32_t fdiv = frate/4; | |
| 13744 | ✗ | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; | |
| 13745 | |||
| 13746 | ✗ | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? | |
| 13747 | ✗ | efrate:((clk>=(frate>>1))?1:0); | |
| 13748 | ✗ | shadowtile = wpnsbuf[spr_shadow].tile; | |
| 13749 | |||
| 13750 | ✗ | if(get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 13751 | { | ||
| 13752 | ✗ | shadowtile+=f2; | |
| 13753 | ✗ | } | |
| 13754 | else | ||
| 13755 | { | ||
| 13756 | ✗ | shadowtile+=f2?1:0; | |
| 13757 | } | ||
| 13758 | |||
| 13759 | ✗ | yofs+=shadowdistance; | |
| 13760 | ✗ | yofs+=8; | |
| 13761 | ✗ | } | |
| 13762 |
3/4✓ Branch 0 taken 1888692 times.
✓ Branch 1 taken 80773 times.
✓ Branch 2 taken 1969465 times.
✗ Branch 3 not taken.
|
1969465 | if((dmisc9 == e9tPOLSVOICE || dmisc9==e9tVIRE) && !get_bit(quest_rules,qr_POLVIRE_NO_SHADOW)) |
| 13763 | { | ||
| 13764 | ✗ | flip = 0; | |
| 13765 | ✗ | int32_t fdiv = frate/4; | |
| 13766 | ✗ | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; | |
| 13767 | |||
| 13768 | ✗ | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? | |
| 13769 | ✗ | efrate:((clk>=(frate>>1))?1:0); | |
| 13770 | ✗ | shadowtile = wpnsbuf[spr_shadow].tile; | |
| 13771 | |||
| 13772 | ✗ | if(get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 13773 | { | ||
| 13774 | ✗ | shadowtile+=f2; | |
| 13775 | ✗ | } | |
| 13776 | else | ||
| 13777 | { | ||
| 13778 | ✗ | shadowtile+=f2?1:0; | |
| 13779 | } | ||
| 13780 | ✗ | } | |
| 13781 |
2/2✓ Branch 0 taken 142 times.
✓ Branch 1 taken 1969323 times.
|
1969465 | if(!shadow_overpit(this)) |
| 13782 | 1969323 | enemy::drawshadow(dest, translucent); | |
| 13783 | 1969465 | yofs=tempy; | |
| 13784 | 1969465 | } | |
| 13785 | |||
| 13786 | 91861 | int32_t eStalfos::takehit(weapon *w, weapon* realweap) | |
| 13787 | { | ||
| 13788 | 91861 | int32_t wpnId = w->id; | |
| 13789 | 91861 | int32_t wpnDir = w->dir; | |
| 13790 | |||
| 13791 |
4/4✓ Branch 0 taken 576 times.
✓ Branch 1 taken 91285 times.
✓ Branch 2 taken 196 times.
✓ Branch 3 taken 380 times.
|
91861 | if(wpnId==wHammer && shield && (flags & guy_bkshield) |
| 13792 |
5/8✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 119 times.
✓ Branch 5 taken 77 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 77 times.
|
196 | && ((flags&inv_front && wpnDir==(dir^down)) || (flags&inv_back && wpnDir==(dir^up)) |
| 13793 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 77 times.
|
77 | || (flags&inv_left && wpnDir==(dir^left)) || (flags&inv_right && wpnDir==(dir^right)))) |
| 13794 | { | ||
| 13795 | 119 | shield = false; | |
| 13796 | 119 | flags &= ~(inv_left|inv_right|inv_back|inv_front); | |
| 13797 | |||
| 13798 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 105 times.
|
119 | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) |
| 13799 | 14 | o_tile=s_tile; | |
| 13800 | 119 | } | |
| 13801 | |||
| 13802 | 91861 | int32_t ret = enemy::takehit(w,realweap); | |
| 13803 | |||
| 13804 |
4/4✓ Branch 0 taken 11242 times.
✓ Branch 1 taken 80619 times.
✓ Branch 2 taken 10025 times.
✓ Branch 3 taken 1217 times.
|
91861 | if(sclk && dmisc2==e2tSPLITHIT) |
| 13805 | 1217 | sclk+=128; //Fuck these arbitrary values with no explanation. Fuck vires, too. -Z | |
| 13806 | |||
| 13807 | 91861 | return ret; | |
| 13808 | } | ||
| 13809 | |||
| 13810 | 549014 | void eStalfos::charge_attack() | |
| 13811 | { | ||
| 13812 |
2/2✓ Branch 0 taken 4914 times.
✓ Branch 1 taken 544100 times.
|
549014 | if(slide()) |
| 13813 | 4914 | return; | |
| 13814 | |||
| 13815 |
9/12✓ Branch 0 taken 544100 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 544100 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 527957 times.
✓ Branch 5 taken 16143 times.
✓ Branch 6 taken 509892 times.
✓ Branch 7 taken 18065 times.
✓ Branch 8 taken 505726 times.
✓ Branch 9 taken 4166 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 505726 times.
|
544100 | if(clk<0 || dir<0 || stunclk || watch || ceiling || frozenclock ) |
| 13816 | 38374 | return; | |
| 13817 | |||
| 13818 |
2/2✓ Branch 0 taken 20208 times.
✓ Branch 1 taken 485518 times.
|
505726 | if(clk3<=0) |
| 13819 | { | ||
| 13820 | 20208 | fix_coords(true); | |
| 13821 | |||
| 13822 |
2/2✓ Branch 0 taken 5611 times.
✓ Branch 1 taken 14597 times.
|
20208 | if(!dashing) |
| 13823 | { | ||
| 13824 | 14597 | int32_t ldir = lined_up(7,false); | |
| 13825 | |||
| 13826 |
4/4✓ Branch 0 taken 1453 times.
✓ Branch 1 taken 13144 times.
✓ Branch 2 taken 1233 times.
✓ Branch 3 taken 220 times.
|
14597 | if(ldir!=-1 && canmove(ldir,false)) |
| 13827 | { | ||
| 13828 | 1233 | dir=ldir; | |
| 13829 | 1233 | dashing=true; | |
| 13830 | 1233 | step=zslongToFix(dstep*100)+1; | |
| 13831 | 1233 | } | |
| 13832 | 13364 | else newdir(4,0,0); | |
| 13833 | 14597 | } | |
| 13834 | |||
| 13835 |
2/2✓ Branch 0 taken 19466 times.
✓ Branch 1 taken 742 times.
|
20208 | if(!canmove(dir,false)) |
| 13836 | { | ||
| 13837 | 742 | step=zslongToFix(dstep*100); | |
| 13838 | 742 | newdir(); | |
| 13839 | 742 | dashing=false; | |
| 13840 | 742 | } | |
| 13841 | |||
| 13842 | 20208 | zfix div = step; | |
| 13843 | |||
| 13844 |
1/2✓ Branch 0 taken 20208 times.
✗ Branch 1 not taken.
|
20208 | if(div == 0) |
| 13845 | ✗ | div = 1; | |
| 13846 | |||
| 13847 | 20208 | clk3=(int32_t)(16.0/div); | |
| 13848 | 20208 | return; | |
| 13849 | } | ||
| 13850 | |||
| 13851 | 485518 | move(step); | |
| 13852 | 485518 | --clk3; | |
| 13853 | 549014 | } | |
| 13854 | |||
| 13855 | 454298 | void eStalfos::vire_hop() | |
| 13856 | { | ||
| 13857 | //if ( sclk > 0 ) return; //Don't hop during knockback. | ||
| 13858 | |||
| 13859 | // if(dmisc9!=e9tPOLSVOICE) | ||
| 13860 | // { | ||
| 13861 | // //if( slide() /*sclk!=0*/ && dmisc2==e2tSPLIT) //Vires with split on hit, only! -Z | ||
| 13862 | // if( sclk!=0 && dmisc2==e2tSPLIT) //Vires with split on hit, only! -Z | ||
| 13863 | // return; //the enemy should split if it is sliding! | ||
| 13864 | // //else sclk=0; //might need this here, too. -Z | ||
| 13865 | // } | ||
| 13866 |
2/2✓ Branch 0 taken 185361 times.
✓ Branch 1 taken 268937 times.
|
454298 | if(dmisc9!=e9tPOLSVOICE) |
| 13867 | { | ||
| 13868 |
2/2✓ Branch 0 taken 180047 times.
✓ Branch 1 taken 5314 times.
|
185361 | if(sclk!=0) |
| 13869 | { | ||
| 13870 |
2/2✓ Branch 0 taken 1471 times.
✓ Branch 1 taken 3843 times.
|
5314 | if (dmisc2==e2tSPLITHIT) return; |
| 13871 | //return; | ||
| 13872 | 3843 | } | |
| 13873 | 183890 | } | |
| 13874 | 268937 | else sclk=0; | |
| 13875 | |||
| 13876 |
8/12✓ Branch 0 taken 452827 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 452827 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 445104 times.
✓ Branch 5 taken 7723 times.
✓ Branch 6 taken 431175 times.
✓ Branch 7 taken 13929 times.
✓ Branch 8 taken 431175 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 431175 times.
|
452827 | if(clk<0 || dying || stunclk || watch || ceiling || frozenclock) |
| 13877 | 21652 | return; | |
| 13878 | |||
| 13879 | 431175 | int32_t jump_width = (dmisc9==e9tPOLSVOICE) ? 2 : 1; | |
| 13880 | 431175 | int32_t jump_height = (dmisc9==e9tPOLSVOICE) ? 27 : 16; | |
| 13881 | |||
| 13882 | 431175 | y=floor_y; | |
| 13883 | |||
| 13884 |
2/2✓ Branch 0 taken 416939 times.
✓ Branch 1 taken 14236 times.
|
431175 | if(clk3<=0) |
| 13885 | { | ||
| 13886 | 14236 | fix_coords(); | |
| 13887 | |||
| 13888 | //z=0; | ||
| 13889 | //if we're not in the middle of a jump or if we can't complete the current jump in the current direction | ||
| 13890 | //if(clk2<=0 || !canmove(dir,(zfix)1,spw_floater,false) || (isSideViewGravity() && isOnSideviewPlatform())) | ||
| 13891 |
9/10✓ Branch 0 taken 2828 times.
✓ Branch 1 taken 11408 times.
✓ Branch 2 taken 2503 times.
✓ Branch 3 taken 325 times.
✓ Branch 4 taken 94 times.
✓ Branch 5 taken 2409 times.
✓ Branch 6 taken 42 times.
✓ Branch 7 taken 52 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 42 times.
|
14236 | if(clk2<=0 || !canmove(dir,(zfix)1,spw_floater,false) || (isSideViewGravity() && (isOnSideviewPlatform() || !(moveflags & FLAG_OBEYS_GRAV)))) //Vires in old quests |
| 13892 | 11827 | newdir(rate,homing,dmisc9==e9tPOLSVOICE ? spw_floater : spw_none); | |
| 13893 | |||
| 13894 |
2/2✓ Branch 0 taken 2828 times.
✓ Branch 1 taken 11408 times.
|
14236 | if(clk2<=0) |
| 13895 | { | ||
| 13896 | //z=0; | ||
| 13897 |
6/6✓ Branch 0 taken 10437 times.
✓ Branch 1 taken 971 times.
✓ Branch 2 taken 10193 times.
✓ Branch 3 taken 244 times.
✓ Branch 4 taken 7420 times.
✓ Branch 5 taken 2773 times.
|
11408 | if(!canmove(dir,(zfix)2,spw_none,false) || m_walkflag(x,y,spw_none, dir) || (zc_oldrand()&15)>=hrate) |
| 13898 | { | ||
| 13899 | |||
| 13900 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8635 times.
|
8635 | clk2=(wpn==ewBrang ? 1 : int32_t((16.0*jump_width)/step.getFloat())); |
| 13901 | /*if (dmisc9==e9tPOLSVOICE ) | ||
| 13902 | { | ||
| 13903 | zprint2("polsvoice jump_width is: %d\n", jump_width); | ||
| 13904 | zprint2("polsvoice raw step is: %d\n", step); | ||
| 13905 | zprint2("polsvoice step.getInt() is: %d\n", step.getInt()); | ||
| 13906 | zprint2("setting clk2 on polsvoice to: %d\n", clk2); | ||
| 13907 | } | ||
| 13908 | else | ||
| 13909 | { | ||
| 13910 | zprint2("vire jump_width is: %d\n", jump_width); | ||
| 13911 | zprint2("vire raw step is: %d\n", step); | ||
| 13912 | zprint2("vire step.getInt() is: %d\n", step.getInt()); | ||
| 13913 | zprint2("setting clk2 on vire to: %d\n", clk2); | ||
| 13914 | } | ||
| 13915 | */ | ||
| 13916 | 8635 | } | |
| 13917 | 11408 | } | |
| 13918 | |||
| 13919 |
4/4✓ Branch 0 taken 5792 times.
✓ Branch 1 taken 8444 times.
✓ Branch 2 taken 2619 times.
✓ Branch 3 taken 3173 times.
|
14236 | if(dmisc9!=e9tPOLSVOICE && dir>=left) //if we're moving left or right |
| 13920 | { | ||
| 13921 | 3173 | clk2=int32_t((16.0*jump_width)/step.getFloat()); | |
| 13922 | 3173 | } | |
| 13923 | |||
| 13924 | 14236 | clk3=int32_t(16.0/step.getFloat()); | |
| 13925 | 14236 | } | |
| 13926 | |||
| 13927 | 431175 | --clk3; | |
| 13928 | |||
| 13929 |
3/4✓ Branch 0 taken 173768 times.
✓ Branch 1 taken 257407 times.
✓ Branch 2 taken 173768 times.
✗ Branch 3 not taken.
|
431175 | if(dmisc9==e9tPOLSVOICE || clk2>0) |
| 13930 | 431175 | move(step); | |
| 13931 | |||
| 13932 | 431175 | floor_y=y; | |
| 13933 | 431175 | clk2--; | |
| 13934 | |||
| 13935 | //if we're in the middle of a jump | ||
| 13936 |
6/6✓ Branch 0 taken 336102 times.
✓ Branch 1 taken 95073 times.
✓ Branch 2 taken 142182 times.
✓ Branch 3 taken 193920 times.
✓ Branch 4 taken 65955 times.
✓ Branch 5 taken 76227 times.
|
431175 | if(clk2>0 && (dir>=left || dmisc9==e9tPOLSVOICE)) |
| 13937 | { | ||
| 13938 | 259875 | int32_t h = fixtoi(fixsin(itofix(clk2*128*step/(16*jump_width)))*jump_height); | |
| 13939 | |||
| 13940 |
4/4✓ Branch 0 taken 97084 times.
✓ Branch 1 taken 162791 times.
✓ Branch 2 taken 6151 times.
✓ Branch 3 taken 90933 times.
|
259875 | if(get_bit(quest_rules,qr_ENEMIESZAXIS) && !(isSideViewGravity())) |
| 13941 | { | ||
| 13942 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 90933 times.
|
90933 | if (moveflags & FLAG_USE_FAKE_Z) fakez=h; |
| 13943 | 90933 | else z=h; | |
| 13944 | 90933 | } | |
| 13945 | else | ||
| 13946 | { | ||
| 13947 | //y+=fixtoi(fixsin(itofix((clk2+1)*128*step/(16*jump_width)))*jump_height); | ||
| 13948 | //y-=h; | ||
| 13949 | 168942 | y=floor_y-h; | |
| 13950 | 168942 | shadowdistance=h; | |
| 13951 | } | ||
| 13952 | 259875 | } | |
| 13953 | else | ||
| 13954 | 171300 | shadowdistance = 0; | |
| 13955 | 454298 | } | |
| 13956 | |||
| 13957 | 51 | void eStalfos::eathero() | |
| 13958 | { | ||
| 13959 |
5/8✓ Branch 0 taken 32 times.
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 32 times.
|
51 | if(!hashero && Hero.getEaten()==0 && Hero.getAction() != hopping && Hero.getAction() != swimming) |
| 13960 | { | ||
| 13961 | 32 | hashero=true; | |
| 13962 | 32 | y=floor_y; | |
| 13963 | 32 | z=0; | |
| 13964 | |||
| 13965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32 times.
|
32 | if(Hero.isSwimming()) |
| 13966 | { | ||
| 13967 | ✗ | Hero.setX(x); | |
| 13968 | ✗ | Hero.setY(y); | |
| 13969 | ✗ | } | |
| 13970 | else | ||
| 13971 | { | ||
| 13972 | 32 | x=Hero.getX(); | |
| 13973 | 32 | y=Hero.getY(); | |
| 13974 | } | ||
| 13975 | |||
| 13976 | 32 | clk2=0; | |
| 13977 | 32 | } | |
| 13978 | 51 | } | |
| 13979 | |||
| 13980 | 951890 | bool eStalfos::WeaponOut() | |
| 13981 | { | ||
| 13982 |
2/2✓ Branch 0 taken 1705421 times.
✓ Branch 1 taken 397502 times.
|
2102923 | for(int32_t i=0; i<Ewpns.Count(); i++) |
| 13983 | { | ||
| 13984 |
3/4✓ Branch 0 taken 554388 times.
✓ Branch 1 taken 1151033 times.
✓ Branch 2 taken 554388 times.
✗ Branch 3 not taken.
|
1705421 | if(((weapon*)Ewpns.spr(i))->parentid==getUID() && Ewpns.spr(i)->id==ewBrang) |
| 13985 | { | ||
| 13986 | 554388 | return true; | |
| 13987 | } | ||
| 13988 | |||
| 13989 | /*if (bgsfx > 0 && guys.idCount(id) < 2) // count self | ||
| 13990 | stop_sfx(bgsfx); | ||
| 13991 | */ | ||
| 13992 | 1151033 | } | |
| 13993 | |||
| 13994 | 397502 | return false; | |
| 13995 | 951890 | } | |
| 13996 | |||
| 13997 | 194123 | void eStalfos::KillWeapon() | |
| 13998 | { | ||
| 13999 |
2/2✓ Branch 0 taken 194123 times.
✓ Branch 1 taken 179385 times.
|
373508 | for(int32_t i=0; i<Ewpns.Count(); i++) |
| 14000 | { | ||
| 14001 |
4/4✓ Branch 0 taken 150605 times.
✓ Branch 1 taken 28780 times.
✓ Branch 2 taken 150087 times.
✓ Branch 3 taken 518 times.
|
179385 | if(((weapon*)Ewpns.spr(i))->type==misc && Ewpns.spr(i)->id==ewBrang) |
| 14002 | { | ||
| 14003 | //only kill this Goriya's boomerang -DD | ||
| 14004 |
2/2✓ Branch 0 taken 293 times.
✓ Branch 1 taken 225 times.
|
518 | if(((weapon *)Ewpns.spr(i))->parentid == getUID()) |
| 14005 | { | ||
| 14006 | 225 | Ewpns.del(i); | |
| 14007 | 225 | } | |
| 14008 | 518 | } | |
| 14009 | 179385 | } | |
| 14010 | |||
| 14011 |
4/4✓ Branch 0 taken 16976 times.
✓ Branch 1 taken 177147 times.
✓ Branch 2 taken 8450 times.
✓ Branch 3 taken 8526 times.
|
194123 | if(wpn==ewBrang && !Ewpns.idCount(ewBrang)) |
| 14012 | { | ||
| 14013 | 8450 | stop_sfx(WAV_BRANG); | |
| 14014 | 8450 | } | |
| 14015 | 194123 | } | |
| 14016 | |||
| 14017 | ✗ | void eStalfos::break_shield() | |
| 14018 | { | ||
| 14019 | ✗ | if(!shield) | |
| 14020 | ✗ | return; | |
| 14021 | |||
| 14022 | ✗ | flags&=~(inv_front | inv_back | inv_left | inv_right); | |
| 14023 | ✗ | shield=false; | |
| 14024 | |||
| 14025 | ✗ | if(get_bit(quest_rules,qr_BRKNSHLDTILES)) | |
| 14026 | ✗ | o_tile=s_tile; | |
| 14027 | ✗ | } | |
| 14028 | |||
| 14029 | 11182 | eKeese::eKeese(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 14030 | 11182 | { | |
| 14031 |
1/2✓ Branch 0 taken 5591 times.
✗ Branch 1 not taken.
|
5591 | dir=(zc_oldrand()&7)+8; |
| 14032 |
1/2✓ Branch 0 taken 5591 times.
✗ Branch 1 not taken.
|
5591 | step=0; |
| 14033 | 5591 | movestatus=1; | |
| 14034 |
3/4✓ Branch 0 taken 4635 times.
✓ Branch 1 taken 956 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4635 times.
|
5591 | if (dmisc1 != 1 && dmisc19 > 0) |
| 14035 | { | ||
| 14036 | ✗ | step = dmisc19/100.0; | |
| 14037 | ✗ | movestatus = 1; | |
| 14038 | ✗ | } | |
| 14039 |
1/2✓ Branch 0 taken 5591 times.
✗ Branch 1 not taken.
|
5591 | if (dmisc1 == 2) movestatus=2; |
| 14040 | 5591 | c=0; | |
| 14041 | 5591 | SIZEflags = d->SIZEflags; | |
| 14042 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
|
5591 | if ( !(SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) ) hxofs=2; |
| 14043 |
1/2✓ Branch 0 taken 5591 times.
✗ Branch 1 not taken.
|
5591 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 14044 | |||
| 14045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
|
5591 | if ( !(SIZEflags&guyflagOVERRIDE_HIT_WIDTH) ) hxsz=12; |
| 14046 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5591 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && d->hxsz >= 0 ) hxsz = d->hxsz; |
| 14047 | |||
| 14048 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
|
5591 | if ( !(SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) ) hyofs=4; |
| 14049 |
1/2✓ Branch 0 taken 5591 times.
✗ Branch 1 not taken.
|
5591 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 14050 | |||
| 14051 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
|
5591 | if ( !(SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) ) hysz=8; |
| 14052 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5591 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && d->hysz >= 0 ) hysz = d->hysz; |
| 14053 | |||
| 14054 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5591 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && d->txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 14055 | //al_trace("->txsz:%i\n", d->txsz); Verified that this is setting the value. -Z | ||
| 14056 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 14057 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5591 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && d->tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 14058 | |||
| 14059 | |||
| 14060 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5591 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && d->hzsz >= 0 ) hzsz = d->hzsz; |
| 14061 | |||
| 14062 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5591 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 14063 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
|
5591 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 14064 | { | ||
| 14065 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 14066 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 14067 | ✗ | } | |
| 14068 | |||
| 14069 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5591 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5591 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 14070 | 5591 | clk4=0; | |
| 14071 | //nets; | ||
| 14072 | 5591 | dummy_int[1]=0; | |
| 14073 | 5591 | } | |
| 14074 | |||
| 14075 | 1654617 | bool eKeese::animate(int32_t index) | |
| 14076 | { | ||
| 14077 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1654617 times.
|
1654617 | if(switch_hooked) return enemy::animate(index); |
| 14078 |
2/4✓ Branch 0 taken 1654617 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1654617 times.
|
1654617 | if(fallclk||drownclk) return enemy::animate(index); |
| 14079 |
2/2✓ Branch 0 taken 62474 times.
✓ Branch 1 taken 1592143 times.
|
1654617 | if(dying) |
| 14080 | 62474 | return Dead(index); | |
| 14081 | |||
| 14082 |
2/2✓ Branch 0 taken 1581657 times.
✓ Branch 1 taken 10486 times.
|
1592143 | if(clk==0) |
| 14083 | { | ||
| 14084 | 10486 | removearmos(x,y,ffcactivated); | |
| 14085 | 10486 | } | |
| 14086 | |||
| 14087 |
2/2✓ Branch 0 taken 368335 times.
✓ Branch 1 taken 1223808 times.
|
1592143 | if(dmisc1 == 1) //Walk style. 0 is keese, 1 is bat. |
| 14088 | { | ||
| 14089 | 368335 | floater_walk(rate,hrate,dstep/100,(zfix)0,10,dmisc16,dmisc17); | |
| 14090 | 368335 | } | |
| 14091 | else | ||
| 14092 | { | ||
| 14093 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1223808 times.
|
1223808 | if (dmisc18) floater_walk(rate,hrate,dstep/100,dmisc18/100.0,-1,dmisc16,dmisc17); |
| 14094 | 1223808 | else floater_walk(rate,hrate,dstep/100,dstep/1000,10,dmisc16,dmisc17); | |
| 14095 | } | ||
| 14096 | |||
| 14097 |
2/2✓ Branch 0 taken 34829 times.
✓ Branch 1 taken 1557314 times.
|
1592143 | if(dmisc2 == e2tKEESETRIB) |
| 14098 | { | ||
| 14099 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 34829 times.
✓ Branch 2 taken 34759 times.
✓ Branch 3 taken 70 times.
|
34829 | if(++clk4==(dmisc20>0?dmisc20:256)) |
| 14100 | { | ||
| 14101 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 52 times.
|
70 | if(!m_walkflag(x,y,0, dir)) |
| 14102 | { | ||
| 14103 | 52 | int32_t kids = guys.Count(); | |
| 14104 | 52 | bool success = false; | |
| 14105 | 52 | int32_t id2=dmisc3; | |
| 14106 | 52 | success = 0 != addenemy((zfix)x,(zfix)y,id2,-24); | |
| 14107 | |||
| 14108 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if(success) |
| 14109 | { | ||
| 14110 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | if(itemguy) // Hand down the carried item |
| 14111 | { | ||
| 14112 | ✗ | guycarryingitem = guys.Count()-1; | |
| 14113 | ✗ | ((enemy*)guys.spr(guycarryingitem))->itemguy = true; | |
| 14114 | ✗ | itemguy = false; | |
| 14115 | ✗ | } | |
| 14116 | |||
| 14117 | 52 | ((enemy*)guys.spr(kids))->count_enemy = count_enemy; | |
| 14118 | 52 | } | |
| 14119 | |||
| 14120 | 52 | stop_bgsfx(index); | |
| 14121 | 52 | return true; | |
| 14122 | } | ||
| 14123 | else | ||
| 14124 | { | ||
| 14125 | 18 | clk4=0; | |
| 14126 | } | ||
| 14127 | 18 | } | |
| 14128 | 34777 | } | |
| 14129 | // Keese Tribbles stay on the ground, so there's no problem when they transform. | ||
| 14130 |
3/4✓ Branch 0 taken 483168 times.
✓ Branch 1 taken 1074146 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 483168 times.
|
1557314 | else if(get_bit(quest_rules,qr_ENEMIESZAXIS) && !(isSideViewGravity())) |
| 14131 | { | ||
| 14132 |
1/2✓ Branch 0 taken 483168 times.
✗ Branch 1 not taken.
|
483168 | if (get_bit(quest_rules,qr_OLD_KEESE_Z_AXIS)) |
| 14133 | { | ||
| 14134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 483168 times.
|
483168 | if (moveflags & FLAG_USE_FAKE_Z) |
| 14135 | { | ||
| 14136 | ✗ | fakez=int32_t(step/zslongToFix(dstep*100)); | |
| 14137 | // Some variance in keese flight heights when away from Hero | ||
| 14138 | ✗ | fakez+=int32_t(step*zc_max(zfix(0),(distance(x,y,HeroX(),HeroY())-128)/10)); | |
| 14139 | |||
| 14140 | ✗ | } | |
| 14141 | else | ||
| 14142 | { | ||
| 14143 | 483168 | z=int32_t(step/zslongToFix(dstep*100)); | |
| 14144 | // Some variance in keese flight heights when away from Hero | ||
| 14145 |
2/2✓ Branch 0 taken 392397 times.
✓ Branch 1 taken 90771 times.
|
483168 | z+=int32_t(step*zc_max(zfix(0),(distance(x,y,HeroX(),HeroY())-128)/10)); |
| 14146 | } | ||
| 14147 | 483168 | } | |
| 14148 | else | ||
| 14149 | { | ||
| 14150 | ✗ | if (moveflags & FLAG_USE_FAKE_Z) | |
| 14151 | { | ||
| 14152 | ✗ | fakez=int32_t(step/zslongToFix(dstep*100)); | |
| 14153 | // Some variance in keese flight heights when away from Hero | ||
| 14154 | ✗ | fakez+=int32_t(step*zc_max(zfix(0),(distance(x,y,HeroX(),HeroY())-40)/4)); | |
| 14155 | |||
| 14156 | ✗ | } | |
| 14157 | else | ||
| 14158 | { | ||
| 14159 | ✗ | z=int32_t(step/zslongToFix(dstep*100)); | |
| 14160 | // Some variance in keese flight heights when away from Hero | ||
| 14161 | ✗ | z+=int32_t(step*zc_max(zfix(0),(distance(x,y,HeroX(),HeroY())-40)/4)); | |
| 14162 | } | ||
| 14163 | } | ||
| 14164 | 483168 | } | |
| 14165 | |||
| 14166 | 1592091 | return enemy::animate(index); | |
| 14167 | 1654617 | } | |
| 14168 | |||
| 14169 | 431730 | void eKeese::drawshadow(BITMAP *dest, bool translucent) | |
| 14170 | { | ||
| 14171 | 431730 | int32_t tempy=yofs; | |
| 14172 | 431730 | flip = 0; | |
| 14173 | 431730 | shadowtile = wpnsbuf[spr_shadow].tile+posframe; | |
| 14174 | |||
| 14175 |
2/2✓ Branch 0 taken 155463 times.
✓ Branch 1 taken 276267 times.
|
431730 | yofs+=zc_min(int32_t(step/zslongToFix(dstep*10)), 8); |
| 14176 |
2/2✓ Branch 0 taken 302522 times.
✓ Branch 1 taken 129208 times.
|
431730 | if(!get_bit(quest_rules,qr_ENEMIESZAXIS)) |
| 14177 | { | ||
| 14178 | 129208 | yofs+=int32_t(step/zslongToFix(dstep*10)); | |
| 14179 | 129208 | } | |
| 14180 | |||
| 14181 |
6/6✓ Branch 0 taken 428136 times.
✓ Branch 1 taken 3594 times.
✓ Branch 2 taken 302522 times.
✓ Branch 3 taken 125614 times.
✓ Branch 4 taken 294452 times.
✓ Branch 5 taken 8070 times.
|
431730 | if(!shadow_overpit(this) && (!get_bit(quest_rules,qr_ENEMIESZAXIS) || step > 0)) |
| 14182 | 420066 | enemy::drawshadow(dest, translucent); | |
| 14183 | 431730 | yofs=tempy; | |
| 14184 | 431730 | } | |
| 14185 | |||
| 14186 | 3779030 | void eKeese::draw(BITMAP *dest) | |
| 14187 | { | ||
| 14188 | 3779030 | update_enemy_frame(); | |
| 14189 | 3779030 | enemy::draw(dest); | |
| 14190 | 3779030 | } | |
| 14191 | |||
| 14192 | 11174 | void eWizzrobe::submerge(bool set) | |
| 14193 | { | ||
| 14194 |
2/2✓ Branch 0 taken 11146 times.
✓ Branch 1 taken 28 times.
|
11174 | if(get_bit(quest_rules,qr_OLD_WIZZROBE_SUBMERGING)) |
| 14195 | { | ||
| 14196 | 11146 | hxofs = set?1000:0; | |
| 14197 | 11146 | return; | |
| 14198 | } | ||
| 14199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
|
28 | if(submerged == set) return; |
| 14200 | 28 | submerged = set; | |
| 14201 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 14 times.
|
28 | if(set) |
| 14202 | 14 | hxofs+=1000; | |
| 14203 | 14 | else hxofs -= 1000; | |
| 14204 | 11174 | } | |
| 14205 | 4192 | eWizzrobe::eWizzrobe(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 14206 | 4192 | { | |
| 14207 | 2096 | hxofs = 0; | |
| 14208 | 2096 | submerged = false; | |
| 14209 |
2/2✓ Branch 0 taken 911 times.
✓ Branch 1 taken 1185 times.
|
2096 | switch(dmisc1) |
| 14210 | { | ||
| 14211 | case 0: | ||
| 14212 |
1/2✓ Branch 0 taken 1185 times.
✗ Branch 1 not taken.
|
1185 | submerge(true); |
| 14213 | 1185 | fading=fade_invisible; | |
| 14214 | // Set clk to just before the 'reappear' threshold | ||
| 14215 |
6/10✗ Branch 0 not taken.
✓ Branch 1 taken 1185 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1185 times.
✓ Branch 4 taken 960 times.
✓ Branch 5 taken 225 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 960 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 225 times.
|
1185 | clk=zc_min(clk+(146+zc_max(0,dmisc5))+14,(146+zc_max(0,dmisc5))-1); |
| 14216 | 1185 | break; | |
| 14217 | |||
| 14218 | default: | ||
| 14219 | 911 | dir=(loadside==right)?right:left; | |
| 14220 | 911 | misc=-3; | |
| 14221 | 911 | break; | |
| 14222 | } | ||
| 14223 | |||
| 14224 | //netst+2880; | ||
| 14225 | 2096 | charging=false; | |
| 14226 | 2096 | firing=false; | |
| 14227 | 2096 | fclk=0; | |
| 14228 |
2/2✓ Branch 0 taken 1185 times.
✓ Branch 1 taken 911 times.
|
2096 | if(!dmisc1) frate=1200+146; //1200 = 20 seconds |
| 14229 | 2096 | SIZEflags = d->SIZEflags; | |
| 14230 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2096 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && d->txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 14231 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 14232 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 14233 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2096 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && d->tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 14234 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2096 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && d->hxsz >= 0 ) hxsz = d->hxsz; |
| 14235 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2096 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && d->hysz >= 0 ) hysz = d->hysz; |
| 14236 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2096 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && d->hzsz >= 0 ) hzsz = d->hzsz; |
| 14237 |
1/2✓ Branch 0 taken 2096 times.
✗ Branch 1 not taken.
|
2096 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) |
| 14238 | { | ||
| 14239 | ✗ | hxofs = (submerged?hxofs:0)+d->hxofs; | |
| 14240 | ✗ | } | |
| 14241 |
1/2✓ Branch 0 taken 2096 times.
✗ Branch 1 not taken.
|
2096 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 14242 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 14243 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2096 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 14244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
|
2096 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 14245 | { | ||
| 14246 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 14247 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 14248 | ✗ | } | |
| 14249 | |||
| 14250 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2096 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 14251 | 2096 | } | |
| 14252 | |||
| 14253 | 994530 | bool eWizzrobe::animate(int32_t index) | |
| 14254 | { | ||
| 14255 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 994530 times.
|
994530 | if(switch_hooked) return enemy::animate(index); |
| 14256 |
2/4✓ Branch 0 taken 994530 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 994530 times.
|
994530 | if(fallclk||drownclk) return enemy::animate(index); |
| 14257 |
2/2✓ Branch 0 taken 21632 times.
✓ Branch 1 taken 972898 times.
|
994530 | if(dying) |
| 14258 | { | ||
| 14259 | 21632 | return Dead(index); | |
| 14260 | } | ||
| 14261 | |||
| 14262 |
2/2✓ Branch 0 taken 941809 times.
✓ Branch 1 taken 31089 times.
|
972898 | if(clk==0) |
| 14263 | { | ||
| 14264 | 31089 | removearmos(x,y,ffcactivated); | |
| 14265 | 31089 | } | |
| 14266 | |||
| 14267 |
2/2✓ Branch 0 taken 494064 times.
✓ Branch 1 taken 478834 times.
|
972898 | if(dmisc1) // Floating |
| 14268 | { | ||
| 14269 | 494064 | wizzrobe_attack(); | |
| 14270 | 494064 | } | |
| 14271 | else // Teleporting | ||
| 14272 | { | ||
| 14273 |
5/6✓ Branch 0 taken 473481 times.
✓ Branch 1 taken 5353 times.
✓ Branch 2 taken 2710 times.
✓ Branch 3 taken 470771 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2710 times.
|
478834 | if(watch || (!get_bit(quest_rules, qr_WIZZROBES_DONT_OBEY_STUN) && stunclk)) |
| 14274 | { | ||
| 14275 | 5353 | fading=0; | |
| 14276 | 5353 | submerge(false); | |
| 14277 | 5353 | solid_update(false); | |
| 14278 | 5353 | } | |
| 14279 |
8/8✓ Branch 0 taken 457745 times.
✓ Branch 1 taken 2806 times.
✓ Branch 2 taken 2438 times.
✓ Branch 3 taken 2363 times.
✓ Branch 4 taken 2326 times.
✓ Branch 5 taken 2022 times.
✓ Branch 6 taken 1951 times.
✓ Branch 7 taken 1830 times.
|
473481 | else switch(clk) |
| 14280 | { | ||
| 14281 | case 0: | ||
| 14282 |
2/2✓ Branch 0 taken 481 times.
✓ Branch 1 taken 2325 times.
|
2806 | if(!dmisc2) |
| 14283 | { | ||
| 14284 | // Wizzrobe Misc4 controls whether wizzrobes can teleport on top of solid combos, | ||
| 14285 | // but should not appear on dungeon walls. | ||
| 14286 |
2/2✓ Branch 0 taken 409 times.
✓ Branch 1 taken 1916 times.
|
2325 | if ( FFCore.getQuestHeaderInfo(vZelda) <= 0x190 ) place_on_axis(true, false); //1.84, and probably 1.90 wizzrobes should NEVER appear in dungeon walls.-Z (1.84 confirmed, 15th January, 2019 by Chris Miller). |
| 14287 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 1871 times.
|
1916 | else if (editorflags&ENEMY_FLAG5) |
| 14288 | { | ||
| 14289 | //2.10 Windrobe | ||
| 14290 | //randomise location and face Hero | ||
| 14291 | 45 | int32_t t=0; | |
| 14292 | 45 | bool placed=false; | |
| 14293 | |||
| 14294 |
4/4✓ Branch 0 taken 45 times.
✓ Branch 1 taken 51 times.
✓ Branch 2 taken 51 times.
✓ Branch 3 taken 45 times.
|
96 | while(!placed && t<160) |
| 14295 | { | ||
| 14296 |
1/2✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
|
51 | if(isdungeon()) |
| 14297 | { | ||
| 14298 | 51 | x=((zc_oldrand()%12)+2)*16; | |
| 14299 | 51 | y=((zc_oldrand()%7)+2)*16; | |
| 14300 | 51 | } | |
| 14301 | else | ||
| 14302 | { | ||
| 14303 | ✗ | x=((zc_oldrand()%14)+1)*16; | |
| 14304 | ✗ | y=((zc_oldrand()%9)+1)*16; | |
| 14305 | } | ||
| 14306 | |||
| 14307 |
6/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 50 times.
✓ Branch 2 taken 40 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 45 times.
|
101 | if(!m_walkflag(x,y,spw_door, dir)&&((abs(x-Hero.getX())>=32)||(abs(y-Hero.getY())>=32))) |
| 14308 | { | ||
| 14309 | 45 | placed=true; | |
| 14310 | 45 | } | |
| 14311 | |||
| 14312 | 51 | ++t; | |
| 14313 | } | ||
| 14314 | |||
| 14315 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 31 times.
|
45 | if(abs(x-Hero.getX())<abs(y-Hero.getY())) |
| 14316 | { | ||
| 14317 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 5 times.
|
14 | if(y<Hero.getY()) |
| 14318 | { | ||
| 14319 | 9 | dir=down; | |
| 14320 | 9 | } | |
| 14321 | else | ||
| 14322 | { | ||
| 14323 | 5 | dir=up; | |
| 14324 | } | ||
| 14325 | 14 | } | |
| 14326 | else | ||
| 14327 | { | ||
| 14328 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 15 times.
|
31 | if(x<Hero.getX()) |
| 14329 | { | ||
| 14330 | 15 | dir=right; | |
| 14331 | 15 | } | |
| 14332 | else | ||
| 14333 | { | ||
| 14334 | 16 | dir=left; | |
| 14335 | } | ||
| 14336 | } | ||
| 14337 | |||
| 14338 |
1/2✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
|
45 | if(!placed) // can't place him, he's gone |
| 14339 | ✗ | return true; | |
| 14340 | |||
| 14341 | |||
| 14342 | //wizzrobe_attack(); //Complaint about 2.10 Windrobes not behaving as they did in 2.10. Let's try it this way. -Z | ||
| 14343 | //wizzrobe_attack_for_real(); //doing this makes them fire twice. The rest is correct. | ||
| 14344 | 45 | } | |
| 14345 | 1871 | else place_on_axis(true, dmisc4!=0); | |
| 14346 | 2325 | } | |
| 14347 | else | ||
| 14348 | { | ||
| 14349 | 481 | int32_t t=0; | |
| 14350 | 481 | bool placed=false; | |
| 14351 | |||
| 14352 |
4/4✓ Branch 0 taken 481 times.
✓ Branch 1 taken 641 times.
✓ Branch 2 taken 641 times.
✓ Branch 3 taken 481 times.
|
1122 | while(!placed && t<160) |
| 14353 | { | ||
| 14354 |
2/2✓ Branch 0 taken 624 times.
✓ Branch 1 taken 17 times.
|
641 | if(isdungeon()) |
| 14355 | { | ||
| 14356 | 624 | x=((zc_oldrand()%12)+2)*16; | |
| 14357 | 624 | y=((zc_oldrand()%7)+2)*16; | |
| 14358 | 624 | } | |
| 14359 | else | ||
| 14360 | { | ||
| 14361 | 17 | x=((zc_oldrand()%14)+1)*16; | |
| 14362 | 17 | y=((zc_oldrand()%9)+1)*16; | |
| 14363 | } | ||
| 14364 | |||
| 14365 |
6/6✓ Branch 0 taken 87 times.
✓ Branch 1 taken 554 times.
✓ Branch 2 taken 389 times.
✓ Branch 3 taken 165 times.
✓ Branch 4 taken 160 times.
✓ Branch 5 taken 481 times.
|
1195 | if(!m_walkflag(x,y,spw_door, dir)&&((abs(x-Hero.getX())>=32)||(abs(y-Hero.getY())>=32))) |
| 14366 | { | ||
| 14367 | 481 | placed=true; | |
| 14368 | 481 | } | |
| 14369 | |||
| 14370 | 641 | ++t; | |
| 14371 | } | ||
| 14372 | |||
| 14373 |
2/2✓ Branch 0 taken 159 times.
✓ Branch 1 taken 322 times.
|
481 | if(abs(x-Hero.getX())<abs(y-Hero.getY())) |
| 14374 | { | ||
| 14375 |
2/2✓ Branch 0 taken 97 times.
✓ Branch 1 taken 62 times.
|
159 | if(y<Hero.getY()) |
| 14376 | { | ||
| 14377 | 97 | dir=down; | |
| 14378 | 97 | } | |
| 14379 | else | ||
| 14380 | { | ||
| 14381 | 62 | dir=up; | |
| 14382 | } | ||
| 14383 | 159 | } | |
| 14384 | else | ||
| 14385 | { | ||
| 14386 |
2/2✓ Branch 0 taken 166 times.
✓ Branch 1 taken 156 times.
|
322 | if(x<Hero.getX()) |
| 14387 | { | ||
| 14388 | 166 | dir=right; | |
| 14389 | 166 | } | |
| 14390 | else | ||
| 14391 | { | ||
| 14392 | 156 | dir=left; | |
| 14393 | } | ||
| 14394 | } | ||
| 14395 | |||
| 14396 |
1/2✓ Branch 0 taken 481 times.
✗ Branch 1 not taken.
|
481 | if(!placed) // can't place him, he's gone |
| 14397 | ✗ | return true; | |
| 14398 | } | ||
| 14399 | |||
| 14400 | 2806 | fading=fade_flicker; | |
| 14401 | 2806 | submerge(false); | |
| 14402 | 2806 | solid_update(false); | |
| 14403 | 2806 | break; | |
| 14404 | |||
| 14405 | case 64: | ||
| 14406 | 2438 | fading=0; | |
| 14407 | 2438 | charging=true; | |
| 14408 | 2438 | break; | |
| 14409 | |||
| 14410 | case 73: | ||
| 14411 | 2363 | charging=false; | |
| 14412 | 2363 | firing=40; | |
| 14413 | 2363 | break; | |
| 14414 | |||
| 14415 | case 83: | ||
| 14416 | 2326 | wizzrobe_attack_for_real(); | |
| 14417 | 2326 | break; | |
| 14418 | |||
| 14419 | case 119: | ||
| 14420 | 2022 | firing=false; | |
| 14421 | 2022 | charging=true; | |
| 14422 | 2022 | break; | |
| 14423 | |||
| 14424 | case 128: | ||
| 14425 | 1951 | fading=fade_flicker; | |
| 14426 | 1951 | charging=false; | |
| 14427 | 1951 | break; | |
| 14428 | |||
| 14429 | case 146: | ||
| 14430 | 1830 | fading=fade_invisible; | |
| 14431 | 1830 | submerge(true); | |
| 14432 | 1830 | solid_update(false); | |
| 14433 | |||
| 14434 | [[fallthrough]]; | ||
| 14435 | default: | ||
| 14436 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 459575 times.
✓ Branch 2 taken 456765 times.
✓ Branch 3 taken 2810 times.
|
459575 | if(clk>=(146+zc_max(0,dmisc5))) |
| 14437 | 2810 | clk=-1; | |
| 14438 | |||
| 14439 | 459575 | break; | |
| 14440 | } | ||
| 14441 | } | ||
| 14442 | |||
| 14443 | 972898 | return enemy::animate(index); | |
| 14444 | 994530 | } | |
| 14445 | |||
| 14446 | 3775 | void eWizzrobe::wizzrobe_attack_for_real() | |
| 14447 | { | ||
| 14448 |
1/2✓ Branch 0 taken 3775 times.
✗ Branch 1 not taken.
|
3775 | if(wpn==0) // Edited enemies |
| 14449 | ✗ | return; | |
| 14450 | |||
| 14451 |
2/2✓ Branch 0 taken 773 times.
✓ Branch 1 taken 3002 times.
|
3775 | if(dmisc2 == 0) //normal weapon |
| 14452 | { | ||
| 14453 | 3002 | addEwpn(x,y,z,wpn,0,wdp,dir,getUID(), 0, fakez); | |
| 14454 | 3002 | sfx(WAV_WAND,pan(int32_t(x))); | |
| 14455 | 3002 | } | |
| 14456 |
2/2✓ Branch 0 taken 323 times.
✓ Branch 1 taken 450 times.
|
773 | else if(dmisc2 == 1) // ring of fire |
| 14457 | { | ||
| 14458 | 323 | addEwpn(x,y,z,wpn,0,wdp,up,getUID(), 0, fakez); | |
| 14459 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14460 | 323 | addEwpn(x,y,z,wpn,0,wdp,down,getUID(), 0, fakez); | |
| 14461 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14462 | 323 | addEwpn(x,y,z,wpn,0,wdp,left,getUID(), 0, fakez); | |
| 14463 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14464 | 323 | addEwpn(x,y,z,wpn,0,wdp,right,getUID(), 0, fakez); | |
| 14465 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14466 | 323 | addEwpn(x,y,z,wpn,0,wdp,l_up,getUID(), 0, fakez); | |
| 14467 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14468 | 323 | addEwpn(x,y,z,wpn,0,wdp,r_up,getUID(), 0, fakez); | |
| 14469 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14470 | 323 | addEwpn(x,y,z,wpn,0,wdp,l_down,getUID(), 0, fakez); | |
| 14471 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14472 | 323 | addEwpn(x,y,z,wpn,0,wdp,r_down,getUID(), 0, fakez); | |
| 14473 | 323 | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 14474 | 323 | sfx(WAV_FIRE,pan(int32_t(x))); | |
| 14475 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 283 times.
|
323 | if (get_bit(quest_rules, qr_8WAY_SHOT_SFX)) sfx(WAV_FIRE,pan(int32_t(x))); |
| 14476 | else | ||
| 14477 | { | ||
| 14478 |
2/18✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 264 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
283 | switch(wpn) |
| 14479 | { | ||
| 14480 | 19 | case ewFireball: sfx(40,pan(int32_t(x))); break; | |
| 14481 | |||
| 14482 | ✗ | case ewArrow: sfx(1,pan(int32_t(x))); break; //Ghost.zh has 0? | |
| 14483 | ✗ | case ewBrang: sfx(4,pan(int32_t(x))); break; //Ghost.zh has 0? | |
| 14484 | ✗ | case ewSword: sfx(20,pan(int32_t(x))); break; //Ghost.zh has 0? | |
| 14485 | ✗ | case ewRock: sfx(51,pan(int32_t(x))); break; | |
| 14486 | ✗ | case ewMagic: sfx(32,pan(int32_t(x))); break; | |
| 14487 | ✗ | case ewBomb: sfx(3,pan(int32_t(x))); break; //Ghost.zh has 0? | |
| 14488 | ✗ | case ewSBomb: sfx(3,pan(int32_t(x))); break; //Ghost.zh has 0? | |
| 14489 | ✗ | case ewLitBomb: sfx(21,pan(int32_t(x))); break; //Ghost.zh has 0? | |
| 14490 | ✗ | case ewLitSBomb: sfx(21,pan(int32_t(x))); break; //Ghost.zh has 0? | |
| 14491 | ✗ | case ewFireTrail: sfx(13,pan(int32_t(x))); break; | |
| 14492 | 264 | case ewFlame: sfx(13,pan(int32_t(x))); break; | |
| 14493 | ✗ | case ewWind: sfx(32,pan(int32_t(x))); break; | |
| 14494 | ✗ | case ewFlame2: sfx(13,pan(int32_t(x))); break; | |
| 14495 | ✗ | case ewFlame2Trail: sfx(13,pan(int32_t(x))); break; | |
| 14496 | ✗ | case ewIce: sfx(44,pan(int32_t(x))); break; | |
| 14497 | ✗ | case ewFireball2: sfx(40,pan(int32_t(x))); break; //fireball (rising) | |
| 14498 | ✗ | default: sfx(WAV_FIRE,pan(int32_t(x))); break; | |
| 14499 | |||
| 14500 | } | ||
| 14501 | } | ||
| 14502 | 323 | } | |
| 14503 |
2/2✓ Branch 0 taken 436 times.
✓ Branch 1 taken 14 times.
|
450 | else if(dmisc2==2) // summons specific enemy |
| 14504 | { | ||
| 14505 | 436 | int32_t bc=0; | |
| 14506 | |||
| 14507 |
2/2✓ Branch 0 taken 5394 times.
✓ Branch 1 taken 436 times.
|
5830 | for(int32_t gc=0; gc<guys.Count(); gc++) |
| 14508 | { | ||
| 14509 |
2/2✓ Branch 0 taken 2590 times.
✓ Branch 1 taken 2804 times.
|
5394 | if((((enemy*)guys.spr(gc))->id) == dmisc3) |
| 14510 | { | ||
| 14511 | 2804 | ++bc; | |
| 14512 | 2804 | } | |
| 14513 | 5394 | } | |
| 14514 | |||
| 14515 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 428 times.
|
436 | if(bc<=40) |
| 14516 | { | ||
| 14517 | 428 | int32_t kids = guys.Count(); | |
| 14518 | 428 | int32_t bats=(zc_oldrand()%3)+1; | |
| 14519 | |||
| 14520 |
2/2✓ Branch 0 taken 868 times.
✓ Branch 1 taken 428 times.
|
1296 | for(int32_t i=0; i<bats; i++) |
| 14521 | { | ||
| 14522 | // Summon bats (or anything) | ||
| 14523 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 868 times.
|
868 | if(addchild(x,y,dmisc3,-10, this->script_UID)) |
| 14524 | 868 | ((enemy*)guys.spr(kids+i))->count_enemy = false; | |
| 14525 | 868 | } | |
| 14526 | |||
| 14527 | 428 | sfx(WAV_FIRE,pan(int32_t(x))); | |
| 14528 | 428 | } | |
| 14529 | 436 | } | |
| 14530 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | else if(dmisc2==3) //summon from layer |
| 14531 | { | ||
| 14532 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(count_layer_enemies()==0) |
| 14533 | { | ||
| 14534 | ✗ | return; | |
| 14535 | } | ||
| 14536 | |||
| 14537 | 14 | int32_t kids = guys.Count(); | |
| 14538 | |||
| 14539 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(kids<200) |
| 14540 | { | ||
| 14541 | 14 | int32_t newguys=(zc_oldrand()%3)+1; | |
| 14542 | 14 | bool summoned=false; | |
| 14543 | |||
| 14544 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 14 times.
|
39 | for(int32_t i=0; i<newguys; i++) |
| 14545 | { | ||
| 14546 | 25 | int32_t id2=vbound(random_layer_enemy(),eSTART,eMAXGUYS-1); | |
| 14547 | 25 | int32_t x2=0; | |
| 14548 | 25 | int32_t y2=0; | |
| 14549 | |||
| 14550 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27 times.
|
27 | for(int32_t k=0; k<20; ++k) |
| 14551 | { | ||
| 14552 | 27 | x2=16*((zc_oldrand()%12)+2); | |
| 14553 | 27 | y2=16*((zc_oldrand()%7)+2); | |
| 14554 | |||
| 14555 |
5/6✗ Branch 0 not taken.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 25 times.
|
54 | if(!m_walkflag(x2,y2,0, dir) && (abs(x2-Hero.getX())>=32 || abs(y2-Hero.getY())>=32)) |
| 14556 | { | ||
| 14557 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if(addchild(x2,y2,get_bit(quest_rules,qr_ENEMIESZAXIS) ? 64 : 0,id2,-10, this->script_UID)) |
| 14558 | { | ||
| 14559 | 25 | ((enemy*)guys.spr(kids+i))->count_enemy = false; | |
| 14560 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
25 | if (get_bit(quest_rules,qr_ENEMIESZAXIS) && (((enemy*)guys.spr(kids+i))->moveflags & FLAG_USE_FAKE_Z)) |
| 14561 | { | ||
| 14562 | ✗ | ((enemy*)guys.spr(kids+i))->fakez = 64; | |
| 14563 | ✗ | ((enemy*)guys.spr(kids+i))->z = 0; | |
| 14564 | ✗ | } | |
| 14565 | 25 | } | |
| 14566 | |||
| 14567 | 25 | summoned=true; | |
| 14568 | 25 | break; | |
| 14569 | } | ||
| 14570 | 2 | } | |
| 14571 | 25 | } | |
| 14572 | |||
| 14573 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(summoned) |
| 14574 | { | ||
| 14575 | 14 | sfx(get_bit(quest_rules,qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE,pan(int32_t(x))); | |
| 14576 | 14 | } | |
| 14577 | 14 | } | |
| 14578 | 14 | } | |
| 14579 | 3775 | } | |
| 14580 | |||
| 14581 | |||
| 14582 | 494064 | void eWizzrobe::wizzrobe_attack() | |
| 14583 | { | ||
| 14584 |
9/12✓ Branch 0 taken 479296 times.
✓ Branch 1 taken 14768 times.
✓ Branch 2 taken 479296 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 460681 times.
✓ Branch 5 taken 18615 times.
✓ Branch 6 taken 458530 times.
✓ Branch 7 taken 2151 times.
✓ Branch 8 taken 458530 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 458530 times.
|
494064 | if(clk<0 || dying || stunclk || watch || ceiling || frozenclock) |
| 14585 | 35534 | return; | |
| 14586 | |||
| 14587 |
3/8✓ Branch 0 taken 440270 times.
✓ Branch 1 taken 18260 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 440270 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
458530 | if(clk3<=0 || ((clk3&31)==0 && !canmove(dir,(zfix)1,spw_door,false) && !misc)) |
| 14588 | { | ||
| 14589 | 18260 | fix_coords(); | |
| 14590 | |||
| 14591 |
5/5✓ Branch 0 taken 2292 times.
✓ Branch 1 taken 591 times.
✓ Branch 2 taken 8571 times.
✓ Branch 3 taken 4700 times.
✓ Branch 4 taken 2106 times.
|
18260 | switch(misc) |
| 14592 | { | ||
| 14593 | case 1: //walking | ||
| 14594 |
2/2✓ Branch 0 taken 3582 times.
✓ Branch 1 taken 1118 times.
|
4700 | if(!m_walkflag(x,y,spw_door, dir)) |
| 14595 | 1118 | misc=0; | |
| 14596 | else | ||
| 14597 | { | ||
| 14598 | 3582 | clk3=16; | |
| 14599 | |||
| 14600 |
2/2✓ Branch 0 taken 3093 times.
✓ Branch 1 taken 489 times.
|
3582 | if(!canmove(dir,(zfix)1,spw_wizzrobe,false)) |
| 14601 | { | ||
| 14602 | 489 | wizzrobe_newdir(0); | |
| 14603 | 489 | } | |
| 14604 | } | ||
| 14605 | |||
| 14606 | 4700 | break; | |
| 14607 | |||
| 14608 | case 2: //phasing | ||
| 14609 | { | ||
| 14610 | 2106 | int32_t jx=x; | |
| 14611 | 2106 | int32_t jy=y; | |
| 14612 | 2106 | int32_t jdir=-1; | |
| 14613 | |||
| 14614 |
5/5✓ Branch 0 taken 1068 times.
✓ Branch 1 taken 274 times.
✓ Branch 2 taken 241 times.
✓ Branch 3 taken 261 times.
✓ Branch 4 taken 262 times.
|
2106 | switch(zc_oldrand()&7) |
| 14615 | { | ||
| 14616 | case 0: | ||
| 14617 | 274 | jx-=32; | |
| 14618 | 274 | jy-=32; | |
| 14619 | 274 | jdir=15; | |
| 14620 | 274 | break; | |
| 14621 | |||
| 14622 | case 1: | ||
| 14623 | 241 | jx+=32; | |
| 14624 | 241 | jy-=32; | |
| 14625 | 241 | jdir=9; | |
| 14626 | 241 | break; | |
| 14627 | |||
| 14628 | case 2: | ||
| 14629 | 261 | jx+=32; | |
| 14630 | 261 | jy+=32; | |
| 14631 | 261 | jdir=11; | |
| 14632 | 261 | break; | |
| 14633 | |||
| 14634 | case 3: | ||
| 14635 | 262 | jx-=32; | |
| 14636 | 262 | jy+=32; | |
| 14637 | 262 | jdir=13; | |
| 14638 | 262 | break; | |
| 14639 | } | ||
| 14640 | |||
| 14641 |
10/10✓ Branch 0 taken 1038 times.
✓ Branch 1 taken 1068 times.
✓ Branch 2 taken 924 times.
✓ Branch 3 taken 114 times.
✓ Branch 4 taken 860 times.
✓ Branch 5 taken 64 times.
✓ Branch 6 taken 749 times.
✓ Branch 7 taken 111 times.
✓ Branch 8 taken 621 times.
✓ Branch 9 taken 128 times.
|
2106 | if(jdir>0 && jx>=32 && jx<=208 && jy>=32 && jy<=128) |
| 14642 | { | ||
| 14643 | 621 | misc=3; | |
| 14644 | 621 | clk3=32; | |
| 14645 | 621 | dir=jdir; | |
| 14646 | 621 | break; | |
| 14647 | } | ||
| 14648 | 1485 | } | |
| 14649 | [[fallthrough]]; | ||
| 14650 | case 3: | ||
| 14651 | 2076 | dir&=3; | |
| 14652 | 2076 | misc=0; | |
| 14653 | [[fallthrough]]; | ||
| 14654 | case 0: | ||
| 14655 | 10647 | wizzrobe_newdir(64); | |
| 14656 | [[fallthrough]]; | ||
| 14657 | default: | ||
| 14658 |
2/2✓ Branch 0 taken 11578 times.
✓ Branch 1 taken 1361 times.
|
12939 | if(!canmove(dir,(zfix)1,spw_door,false)) |
| 14659 | { | ||
| 14660 |
2/2✓ Branch 0 taken 1295 times.
✓ Branch 1 taken 66 times.
|
1361 | if(canmove(dir,(zfix)15,spw_wizzrobe,false)) |
| 14661 | { | ||
| 14662 | 1295 | misc=1; | |
| 14663 | 1295 | clk3=16; | |
| 14664 | 1295 | } | |
| 14665 | else | ||
| 14666 | { | ||
| 14667 | 66 | wizzrobe_newdir(64); | |
| 14668 | 66 | misc=0; | |
| 14669 | 66 | clk3=32; | |
| 14670 | } | ||
| 14671 | 1361 | } | |
| 14672 | else | ||
| 14673 | { | ||
| 14674 | 11578 | clk3=32; | |
| 14675 | } | ||
| 14676 | |||
| 14677 | 12939 | break; | |
| 14678 | } | ||
| 14679 | |||
| 14680 |
2/2✓ Branch 0 taken 16254 times.
✓ Branch 1 taken 2006 times.
|
18260 | if(misc<0) |
| 14681 | 2006 | ++misc; | |
| 14682 | 18260 | } | |
| 14683 | |||
| 14684 | 458530 | --clk3; | |
| 14685 | |||
| 14686 |
3/3✓ Branch 0 taken 96043 times.
✓ Branch 1 taken 327675 times.
✓ Branch 2 taken 34812 times.
|
458530 | switch(misc) |
| 14687 | { | ||
| 14688 | case 1: | ||
| 14689 | case 3: | ||
| 14690 | 96043 | step=1; | |
| 14691 | 96043 | break; | |
| 14692 | |||
| 14693 | case 2: | ||
| 14694 | 34812 | step=0; | |
| 14695 | 34812 | break; | |
| 14696 | |||
| 14697 | default: | ||
| 14698 | 327675 | step=0.5; | |
| 14699 | 327675 | break; | |
| 14700 | |||
| 14701 | } | ||
| 14702 | |||
| 14703 | 458530 | move(step); | |
| 14704 | |||
| 14705 | // if(d->misc1 && misc<=0 && clk3==28) | ||
| 14706 |
5/6✓ Branch 0 taken 458530 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 327675 times.
✓ Branch 3 taken 130855 times.
✓ Branch 4 taken 316347 times.
✓ Branch 5 taken 11328 times.
|
458530 | if(dmisc1 && misc<=0 && clk3==28) |
| 14707 | { | ||
| 14708 |
2/2✓ Branch 0 taken 9880 times.
✓ Branch 1 taken 1448 times.
|
11328 | if(dmisc2 != 1) |
| 14709 | { | ||
| 14710 |
2/2✓ Branch 0 taken 8754 times.
✓ Branch 1 taken 1126 times.
|
9880 | if(lined_up(8,false) == dir) |
| 14711 | { | ||
| 14712 | // addEwpn(x,y,z,wpn,0,wdp,dir,getUID()); | ||
| 14713 | // sfx(WAV_WAND,pan(int32_t(x))); | ||
| 14714 | 1126 | wizzrobe_attack_for_real(); | |
| 14715 | 1126 | fclk=30; | |
| 14716 | 1126 | } | |
| 14717 | 9880 | } | |
| 14718 | else | ||
| 14719 | { | ||
| 14720 |
2/2✓ Branch 0 taken 1125 times.
✓ Branch 1 taken 323 times.
|
1448 | if((zc_oldrand()%500)>=400) |
| 14721 | { | ||
| 14722 | 323 | wizzrobe_attack_for_real(); | |
| 14723 | 323 | fclk=30; | |
| 14724 | 323 | } | |
| 14725 | } | ||
| 14726 | 11328 | } | |
| 14727 | |||
| 14728 |
4/4✓ Branch 0 taken 282550 times.
✓ Branch 1 taken 175980 times.
✓ Branch 2 taken 2168 times.
✓ Branch 3 taken 280382 times.
|
458530 | if(misc==0 && (zc_oldrand()&127)==0) |
| 14729 | 2168 | misc=2; | |
| 14730 | |||
| 14731 |
4/4✓ Branch 0 taken 36980 times.
✓ Branch 1 taken 421550 times.
✓ Branch 2 taken 35119 times.
✓ Branch 3 taken 1861 times.
|
458530 | if(misc==2 && clk3==4) |
| 14732 | 1861 | fix_coords(); | |
| 14733 | |||
| 14734 |
2/4✓ Branch 0 taken 458530 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 458530 times.
|
458530 | if(!(charging||firing)) //should never be charging or firing for these wizzrobes |
| 14735 | { | ||
| 14736 |
2/2✓ Branch 0 taken 417284 times.
✓ Branch 1 taken 41246 times.
|
458530 | if(fclk>0) |
| 14737 | { | ||
| 14738 | 41246 | --fclk; | |
| 14739 | 41246 | } | |
| 14740 | 458530 | } | |
| 14741 | |||
| 14742 | 494064 | } | |
| 14743 | |||
| 14744 | 11202 | void eWizzrobe::wizzrobe_newdir(int32_t homing) | |
| 14745 | { | ||
| 14746 | // Wizzrobes shouldn't move to the edge of the screen; | ||
| 14747 | // if they're already there, they should move toward the center | ||
| 14748 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 11198 times.
|
11202 | if(x<32) |
| 14749 | 4 | dir=right; | |
| 14750 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11198 times.
|
11198 | else if(x>=224) |
| 14751 | ✗ | dir=left; | |
| 14752 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11198 times.
|
11198 | else if(y<32) |
| 14753 | ✗ | dir=down; | |
| 14754 |
1/2✓ Branch 0 taken 11198 times.
✗ Branch 1 not taken.
|
11198 | else if(y>=144) |
| 14755 | ✗ | dir=up; | |
| 14756 | else | ||
| 14757 | 11198 | newdir(4,homing,spw_wizzrobe); | |
| 14758 | 11202 | } | |
| 14759 | |||
| 14760 | 997386 | void eWizzrobe::draw(BITMAP *dest) | |
| 14761 | { | ||
| 14762 | // if(d->misc1 && (misc==1 || misc==3) && (clk3&1) && hp>0 && !watch && !stunclk) // phasing | ||
| 14763 |
13/14✓ Branch 0 taken 503916 times.
✓ Branch 1 taken 493470 times.
✓ Branch 2 taken 422836 times.
✓ Branch 3 taken 81080 times.
✓ Branch 4 taken 51740 times.
✓ Branch 5 taken 452176 times.
✓ Branch 6 taken 51056 times.
✓ Branch 7 taken 684 times.
✓ Branch 8 taken 50299 times.
✓ Branch 9 taken 757 times.
✓ Branch 10 taken 48078 times.
✓ Branch 11 taken 2221 times.
✓ Branch 12 taken 48078 times.
✗ Branch 13 not taken.
|
997386 | if(dmisc1 && (misc==1 || misc==3) && (clk3&1) && hp>0 && !watch && !stunclk && !frozenclock) // phasing |
| 14764 | 48078 | return; | |
| 14765 | |||
| 14766 | 949308 | int32_t tempint=dummy_int[1]; | |
| 14767 | 949308 | bool tempbool1=dummy_bool[1]; | |
| 14768 | 949308 | bool tempbool2=dummy_bool[2]; | |
| 14769 | 949308 | dummy_int[1]=fclk; | |
| 14770 | 949308 | dummy_bool[1]=charging; | |
| 14771 | 949308 | dummy_bool[2]=firing; | |
| 14772 | 949308 | update_enemy_frame(); | |
| 14773 | 949308 | dummy_int[1]=tempint; | |
| 14774 | 949308 | dummy_bool[1]=tempbool1; | |
| 14775 | 949308 | dummy_bool[2]=tempbool2; | |
| 14776 | 949308 | enemy::draw(dest); | |
| 14777 | 997386 | } | |
| 14778 | |||
| 14779 | /*********************************/ | ||
| 14780 | /********** Bosses ***********/ | ||
| 14781 | /*********************************/ | ||
| 14782 | |||
| 14783 | 270 | eDodongo::eDodongo(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 14784 | 270 | { | |
| 14785 | 135 | fading=fade_flash_die; | |
| 14786 | //nets+5120; | ||
| 14787 |
6/8✓ Branch 0 taken 102 times.
✓ Branch 1 taken 33 times.
✓ Branch 2 taken 33 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 33 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 30 times.
✓ Branch 7 taken 3 times.
|
135 | if(dir==down&&y>=128) |
| 14788 | { | ||
| 14789 | 3 | dir=up; | |
| 14790 | 3 | } | |
| 14791 | |||
| 14792 |
5/8✓ Branch 0 taken 41 times.
✓ Branch 1 taken 94 times.
✓ Branch 2 taken 41 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 41 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 41 times.
✗ Branch 7 not taken.
|
135 | if(dir==right&&x>=208) |
| 14793 | { | ||
| 14794 | ✗ | dir=left; | |
| 14795 | ✗ | } | |
| 14796 | 135 | SIZEflags = d->SIZEflags; | |
| 14797 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
135 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 14798 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 14799 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 14800 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
135 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 14801 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
135 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 14802 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
135 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 14803 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
135 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 14804 |
1/2✓ Branch 0 taken 135 times.
✗ Branch 1 not taken.
|
135 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 14805 |
1/2✓ Branch 0 taken 135 times.
✗ Branch 1 not taken.
|
135 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 14806 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 14807 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
135 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 14808 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
|
135 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 14809 | { | ||
| 14810 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 14811 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 14812 | ✗ | } | |
| 14813 | |||
| 14814 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
135 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)zofs; |
| 14815 | 135 | } | |
| 14816 | |||
| 14817 | 91780 | bool eDodongo::animate(int32_t index) | |
| 14818 | { | ||
| 14819 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 91780 times.
|
91780 | if(switch_hooked) return enemy::animate(index); |
| 14820 |
2/2✓ Branch 0 taken 3114 times.
✓ Branch 1 taken 88666 times.
|
91780 | if(dying) |
| 14821 | { | ||
| 14822 | 3114 | return Dead(index); | |
| 14823 | } | ||
| 14824 | |||
| 14825 |
2/2✓ Branch 0 taken 88263 times.
✓ Branch 1 taken 403 times.
|
88666 | if(clk==0) |
| 14826 | { | ||
| 14827 | 403 | removearmos(x,y,ffcactivated); | |
| 14828 | 403 | } | |
| 14829 | |||
| 14830 |
2/2✓ Branch 0 taken 8448 times.
✓ Branch 1 taken 80218 times.
|
88666 | if(clk2) // ate a bomb |
| 14831 | { | ||
| 14832 |
2/2✓ Branch 0 taken 8360 times.
✓ Branch 1 taken 88 times.
|
8448 | if(--clk2==0) |
| 14833 | 88 | hp-=misc; // store bomb's power in misc | |
| 14834 | 8448 | } | |
| 14835 | else | ||
| 14836 | 80218 | constant_walk(rate,homing,spw_clipright); | |
| 14837 | |||
| 14838 | 88666 | hxsz = (dir<=down) ? 16 : 32; | |
| 14839 | // hysz = (dir>=left) ? 16 : 32; | ||
| 14840 | |||
| 14841 | 88666 | return enemy::animate(index); | |
| 14842 | 91780 | } | |
| 14843 | |||
| 14844 | 91771 | void eDodongo::draw(BITMAP *dest) | |
| 14845 | { | ||
| 14846 | 91771 | tile=o_tile; | |
| 14847 | |||
| 14848 |
2/2✓ Branch 0 taken 2212 times.
✓ Branch 1 taken 89559 times.
|
91771 | if(clk<0) |
| 14849 | { | ||
| 14850 | 2212 | enemy::drawzcboss(dest); | |
| 14851 | 2212 | return; | |
| 14852 | } | ||
| 14853 | |||
| 14854 | 89559 | update_enemy_frame(); | |
| 14855 | 89559 | enemy::drawzcboss(dest); | |
| 14856 | |||
| 14857 |
2/2✓ Branch 0 taken 36564 times.
✓ Branch 1 taken 52995 times.
|
89559 | if(dummy_int[1]!=0) //additional tiles |
| 14858 | { | ||
| 14859 | 52995 | tile+=dummy_int[1]; //second tile is previous tile | |
| 14860 | 52995 | xofs-=16; //new xofs change | |
| 14861 | 52995 | enemy::drawzcboss(dest); | |
| 14862 | 52995 | xofs+=16; | |
| 14863 | 52995 | } | |
| 14864 | |||
| 14865 | 91771 | } | |
| 14866 | |||
| 14867 | 5941 | int32_t eDodongo::takehit(weapon *w, weapon* realweap) | |
| 14868 | { | ||
| 14869 | 5941 | int32_t wpnId = w->id; | |
| 14870 | 5941 | int32_t power = w->power; | |
| 14871 | 5941 | int32_t wpnx = w->x; | |
| 14872 | 5941 | int32_t wpny = w->y; | |
| 14873 | |||
| 14874 |
5/12✓ Branch 0 taken 5941 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5941 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1675 times.
✓ Branch 5 taken 4266 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1675 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
5941 | if(dying || clk<0 || clk2>0 || (superman && !(superman>1 && wpnId==wSBomb))) |
| 14875 | 4266 | return 0; | |
| 14876 | |||
| 14877 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 599 times.
✓ Branch 2 taken 966 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 94 times.
|
1675 | switch(wpnId) |
| 14878 | { | ||
| 14879 | case wPhantom: | ||
| 14880 | ✗ | return 0; | |
| 14881 | |||
| 14882 | case wFire: | ||
| 14883 | case wBait: | ||
| 14884 | case wWhistle: | ||
| 14885 | case wWind: | ||
| 14886 | case wSSparkle: | ||
| 14887 | case wFSparkle: | ||
| 14888 | ✗ | return 0; | |
| 14889 | |||
| 14890 | case wLitBomb: | ||
| 14891 | case wLitSBomb: | ||
| 14892 |
6/6✓ Branch 0 taken 204 times.
✓ Branch 1 taken 395 times.
✓ Branch 2 taken 235 times.
✓ Branch 3 taken 364 times.
✓ Branch 4 taken 511 times.
✓ Branch 5 taken 88 times.
|
599 | if(abs(wpnx-((dir==right)?x+16:x)) > 7 || abs(wpny-y) > 7) |
| 14893 | 511 | return 0; | |
| 14894 | |||
| 14895 | 88 | clk2=96; | |
| 14896 | 88 | misc=power; | |
| 14897 | |||
| 14898 |
2/2✓ Branch 0 taken 85 times.
✓ Branch 1 taken 3 times.
|
88 | if(wpnId==wLitSBomb) |
| 14899 | 3 | item_set=isSBOMB100; | |
| 14900 | |||
| 14901 | 88 | return 1; | |
| 14902 | |||
| 14903 | case wBomb: | ||
| 14904 | case wSBomb: | ||
| 14905 |
6/6✓ Branch 0 taken 389 times.
✓ Branch 1 taken 577 times.
✓ Branch 2 taken 289 times.
✓ Branch 3 taken 677 times.
✓ Branch 4 taken 349 times.
✓ Branch 5 taken 617 times.
|
966 | if(abs(wpnx-((dir==right)?x+16:x)) > 8 || abs(wpny-y) > 8) |
| 14906 | 349 | return 0; | |
| 14907 | |||
| 14908 | 617 | stunclk=160; | |
| 14909 | 617 | misc=wpnId; // store wpnId | |
| 14910 | 617 | return 1; | |
| 14911 | |||
| 14912 | case wSword: | ||
| 14913 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 63 times.
|
94 | if(stunclk) |
| 14914 | { | ||
| 14915 | 63 | sfx(WAV_EHIT,pan(int32_t(x))); | |
| 14916 | 63 | hp=0; | |
| 14917 | 63 | item_set = (misc==wSBomb) ? isSBOMB100 : isBOMB100; | |
| 14918 | 63 | fading=0; // don't flash | |
| 14919 | 63 | return 1; | |
| 14920 | } | ||
| 14921 | |||
| 14922 | [[fallthrough]]; | ||
| 14923 | default: | ||
| 14924 | 47 | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 14925 | 47 | } | |
| 14926 | |||
| 14927 | 47 | return 1; | |
| 14928 | 5941 | } | |
| 14929 | |||
| 14930 | 4 | eDodongo2::eDodongo2(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 14931 | 4 | { | |
| 14932 | 2 | fading=fade_flash_die; | |
| 14933 | //nets+5180; | ||
| 14934 | 2 | previous_dir=-1; | |
| 14935 |
5/8✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | if(dir==down&&y>=128) |
| 14936 | { | ||
| 14937 | ✗ | dir=up; | |
| 14938 | ✗ | } | |
| 14939 | |||
| 14940 |
5/8✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | if(dir==right&&x>=208) |
| 14941 | { | ||
| 14942 | ✗ | dir=left; | |
| 14943 | ✗ | } | |
| 14944 | 2 | SIZEflags = d->SIZEflags; | |
| 14945 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 14946 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 14947 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 14948 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 14949 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 14950 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 14951 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 14952 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 14953 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 14954 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 14955 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 14956 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 14957 | { | ||
| 14958 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 14959 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 14960 | ✗ | } | |
| 14961 | |||
| 14962 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)zofs; |
| 14963 | 2 | } | |
| 14964 | |||
| 14965 | 848 | bool eDodongo2::animate(int32_t index) | |
| 14966 | { | ||
| 14967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 848 times.
|
848 | if(switch_hooked) return enemy::animate(index); |
| 14968 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 812 times.
|
848 | if(dying) |
| 14969 | { | ||
| 14970 | 36 | return Dead(index); | |
| 14971 | } | ||
| 14972 | |||
| 14973 |
2/2✓ Branch 0 taken 808 times.
✓ Branch 1 taken 4 times.
|
812 | if(clk==0) |
| 14974 | { | ||
| 14975 | 4 | removearmos(x,y,ffcactivated); | |
| 14976 | 4 | } | |
| 14977 | |||
| 14978 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 620 times.
|
812 | if(clk2) // ate a bomb |
| 14979 | { | ||
| 14980 |
2/2✓ Branch 0 taken 190 times.
✓ Branch 1 taken 2 times.
|
192 | if(--clk2==0) |
| 14981 | 2 | hp-=misc; // store bomb's power in misc | |
| 14982 | 192 | } | |
| 14983 | else | ||
| 14984 | 620 | constant_walk(rate,homing,spw_clipbottomright); | |
| 14985 | |||
| 14986 | 812 | hxsz = (dir<=down) ? 16 : 32; | |
| 14987 | 812 | hysz = (dir>=left) ? 16 : 32; | |
| 14988 | 812 | hxofs=(dir>=left)?-8:0; | |
| 14989 | 812 | hyofs=(dir<left)?-8:0; | |
| 14990 | |||
| 14991 | 812 | return enemy::animate(index); | |
| 14992 | 848 | } | |
| 14993 | |||
| 14994 | 848 | void eDodongo2::draw(BITMAP *dest) | |
| 14995 | { | ||
| 14996 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 818 times.
|
848 | if(clk<0) |
| 14997 | { | ||
| 14998 | 30 | enemy::drawzcboss(dest); | |
| 14999 | 30 | return; | |
| 15000 | } | ||
| 15001 | |||
| 15002 | 818 | int32_t tempx=xofs; | |
| 15003 | 818 | int32_t tempy=yofs; | |
| 15004 | 818 | update_enemy_frame(); | |
| 15005 | 818 | enemy::drawzcboss(dest); | |
| 15006 | 818 | tile+=dummy_int[1]; //second tile change | |
| 15007 | 818 | xofs+=dummy_int[2]; //new xofs change | |
| 15008 | 818 | yofs+=dummy_int[3]; //new yofs change | |
| 15009 | 818 | enemy::drawzcboss(dest); | |
| 15010 | 818 | xofs=tempx; | |
| 15011 | 818 | yofs=tempy; | |
| 15012 | 848 | } | |
| 15013 | |||
| 15014 | 165 | int32_t eDodongo2::takehit(weapon *w, weapon* realweap) | |
| 15015 | { | ||
| 15016 | 165 | int32_t wpnId = w->id; | |
| 15017 | 165 | int32_t power = w->power; | |
| 15018 | 165 | int32_t wpnx = w->x; | |
| 15019 | 165 | int32_t wpny = w->y; | |
| 15020 | |||
| 15021 |
5/8✓ Branch 0 taken 165 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 165 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 145 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20 times.
|
165 | if(dying || clk<0 || clk2>0 || superman) |
| 15022 | 145 | return 0; | |
| 15023 | |||
| 15024 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
20 | switch(wpnId) |
| 15025 | { | ||
| 15026 | case wPhantom: | ||
| 15027 | ✗ | return 0; | |
| 15028 | |||
| 15029 | case wFire: | ||
| 15030 | case wBait: | ||
| 15031 | case wWhistle: | ||
| 15032 | case wWind: | ||
| 15033 | case wSSparkle: | ||
| 15034 | case wFSparkle: | ||
| 15035 | ✗ | return 0; | |
| 15036 | |||
| 15037 | case wLitBomb: | ||
| 15038 | case wLitSBomb: | ||
| 15039 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | switch(dir) |
| 15040 | { | ||
| 15041 | case up: | ||
| 15042 | ✗ | if(abs(wpnx-x) > 7 || abs(wpny-(y-8)) > 7) | |
| 15043 | ✗ | return 0; | |
| 15044 | |||
| 15045 | ✗ | break; | |
| 15046 | |||
| 15047 | case down: | ||
| 15048 | ✗ | if(abs(wpnx-x) > 7 || abs(wpny-(y+8)) > 7) | |
| 15049 | ✗ | return 0; | |
| 15050 | |||
| 15051 | ✗ | break; | |
| 15052 | |||
| 15053 | case left: | ||
| 15054 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
2 | if(abs(wpnx-(x-8)) > 7 || abs(wpny-y) > 7) |
| 15055 | ✗ | return 0; | |
| 15056 | |||
| 15057 | 2 | break; | |
| 15058 | |||
| 15059 | case right: | ||
| 15060 | ✗ | if(abs(wpnx-(x+8)) > 7 || abs(wpny-y) > 7) | |
| 15061 | ✗ | return 0; | |
| 15062 | |||
| 15063 | ✗ | break; | |
| 15064 | } | ||
| 15065 | |||
| 15066 | // if(abs(wpnx-((dir==right)?x+8:(dir==left)?x-8:0)) > 7 || abs(wpny-((dir==down)?y+8:(dir==up)?y-8:0)) > 7) | ||
| 15067 | // return 0; | ||
| 15068 | 2 | clk2=96; | |
| 15069 | 2 | misc=power; | |
| 15070 | |||
| 15071 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(wpnId==wLitSBomb) |
| 15072 | ✗ | item_set=isSBOMB100; | |
| 15073 | |||
| 15074 | 2 | return 1; | |
| 15075 | |||
| 15076 | case wBomb: | ||
| 15077 | case wSBomb: | ||
| 15078 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
✗ Branch 4 not taken.
|
15 | switch(dir) |
| 15079 | { | ||
| 15080 | case up: | ||
| 15081 | ✗ | if(abs(wpnx-x) > 7 || abs(wpny-(y-8)) > 7) | |
| 15082 | ✗ | return 0; | |
| 15083 | |||
| 15084 | ✗ | break; | |
| 15085 | |||
| 15086 | case down: | ||
| 15087 | ✗ | if(abs(wpnx-x) > 7 || abs(wpny-(y+8)) > 7) | |
| 15088 | ✗ | return 0; | |
| 15089 | |||
| 15090 | ✗ | break; | |
| 15091 | |||
| 15092 | case left: | ||
| 15093 |
2/4✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15 times.
|
15 | if(abs(wpnx-(x-8)) > 7 || abs(wpny-y) > 7) |
| 15094 | ✗ | return 0; | |
| 15095 | |||
| 15096 | 15 | break; | |
| 15097 | |||
| 15098 | case right: | ||
| 15099 | ✗ | if(abs(wpnx-(x+8)) > 7 || abs(wpny-y) > 7) | |
| 15100 | ✗ | return 0; | |
| 15101 | |||
| 15102 | ✗ | break; | |
| 15103 | } | ||
| 15104 | |||
| 15105 | 15 | stunclk=160; | |
| 15106 | 15 | misc=wpnId; // store wpnId | |
| 15107 | 15 | return 1; | |
| 15108 | |||
| 15109 | case wSword: | ||
| 15110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(stunclk) |
| 15111 | { | ||
| 15112 | 2 | sfx(WAV_EHIT,pan(int32_t(x))); | |
| 15113 | 2 | hp=0; | |
| 15114 | 2 | item_set = (misc==wSBomb) ? isSBOMB100 : isBOMB100; | |
| 15115 | 2 | fading=0; // don't flash | |
| 15116 | 2 | return 1; | |
| 15117 | } | ||
| 15118 | |||
| 15119 | [[fallthrough]]; | ||
| 15120 | default: | ||
| 15121 | 1 | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 15122 | 1 | } | |
| 15123 | |||
| 15124 | 1 | return 1; | |
| 15125 | 165 | } | |
| 15126 | |||
| 15127 | 148 | eAquamentus::eAquamentus(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk)//enemy((zfix)176,(zfix)64,Id,Clk) | |
| 15128 | 148 | { | |
| 15129 | //these are here to bypass compiler warnings about unused arguments | ||
| 15130 |
1/2✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
|
74 | if ( !(editorflags & ENEMY_FLAG5) ) |
| 15131 | { | ||
| 15132 |
1/2✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
|
74 | x = dmisc1 ? 64 : 176; |
| 15133 |
1/2✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
|
74 | y = 64; |
| 15134 | 74 | } | |
| 15135 | ✗ | else { x = X; y = Y; } | |
| 15136 | |||
| 15137 | //nets+5940; | ||
| 15138 |
3/4✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✓ Branch 3 taken 33 times.
|
74 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 15139 | { | ||
| 15140 | 41 | } | |
| 15141 | else | ||
| 15142 | { | ||
| 15143 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 26 times.
|
33 | if(dmisc1) |
| 15144 | { | ||
| 15145 | 7 | flip=1; | |
| 15146 | 7 | } | |
| 15147 | } | ||
| 15148 | |||
| 15149 |
3/6✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 74 times.
✓ Branch 4 taken 74 times.
✗ Branch 5 not taken.
|
74 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset)+1; |
| 15150 | 74 | clk3=32; | |
| 15151 | 74 | clk2=0; | |
| 15152 | 74 | clk4=clk; | |
| 15153 | 74 | dir=left; | |
| 15154 | 74 | SIZEflags = d->SIZEflags; | |
| 15155 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
74 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 15156 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 15157 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 15158 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
74 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 15159 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
74 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 15160 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
74 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 15161 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
74 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 15162 |
1/2✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
|
74 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 15163 |
1/2✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
|
74 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 15164 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 15165 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
74 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 15166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
|
74 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 15167 | { | ||
| 15168 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 15169 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 15170 | ✗ | } | |
| 15171 | |||
| 15172 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
74 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 15173 | 74 | } | |
| 15174 | |||
| 15175 | 47152 | bool eAquamentus::animate(int32_t index) | |
| 15176 | { | ||
| 15177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47152 times.
|
47152 | if(switch_hooked) return enemy::animate(index); |
| 15178 |
2/2✓ Branch 0 taken 1238 times.
✓ Branch 1 taken 45914 times.
|
47152 | if(dying) |
| 15179 | 1238 | return Dead(index); | |
| 15180 | |||
| 15181 | // fbx=x+((id==eRAQUAM)?4:-4); | ||
| 15182 |
2/2✓ Branch 0 taken 45708 times.
✓ Branch 1 taken 206 times.
|
45914 | if(clk==0) |
| 15183 | { | ||
| 15184 | 206 | removearmos(x,y,ffcactivated); | |
| 15185 | 206 | } | |
| 15186 | |||
| 15187 | 45914 | fbx=x; | |
| 15188 | |||
| 15189 | /* | ||
| 15190 | if (get_bit(quest_rules,qr_NEWENEMYTILES)&&id==eLAQUAM) | ||
| 15191 | { | ||
| 15192 | fbx+=16; | ||
| 15193 | } | ||
| 15194 | */ | ||
| 15195 |
2/2✓ Branch 0 taken 45620 times.
✓ Branch 1 taken 294 times.
|
45914 | if(--clk3==0) |
| 15196 | { | ||
| 15197 | // addEwpn(fbx,y,z,ewFireball,0,d->wdp,up+1); | ||
| 15198 | // addEwpn(fbx,y,z,ewFireball,0,d->wdp,0); | ||
| 15199 | // addEwpn(fbx,y,z,ewFireball,0,d->wdp,down+1); | ||
| 15200 | 294 | addEwpn(fbx,y,z,wpn,2,wdp,up,getUID(), 0, fakez); | |
| 15201 | 294 | addEwpn(fbx,y,z,wpn,2,wdp,8,getUID(), 0, fakez); | |
| 15202 | 294 | addEwpn(fbx,y,z,wpn,2,wdp,down,getUID(), 0, fakez); | |
| 15203 | 294 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 15204 | 294 | } | |
| 15205 | |||
| 15206 |
4/4✓ Branch 0 taken 14065 times.
✓ Branch 1 taken 31849 times.
✓ Branch 2 taken 232 times.
✓ Branch 3 taken 13833 times.
|
45914 | if(clk3<-80 && !(zc_oldrand()&63)) |
| 15207 | { | ||
| 15208 | 232 | clk3=32; | |
| 15209 | 232 | } | |
| 15210 | |||
| 15211 |
2/2✓ Branch 0 taken 45180 times.
✓ Branch 1 taken 734 times.
|
45914 | if(!((clk4+1)&63)) |
| 15212 | { | ||
| 15213 | 734 | int32_t d2=(zc_oldrand()%3)+1; | |
| 15214 | |||
| 15215 |
2/2✓ Branch 0 taken 238 times.
✓ Branch 1 taken 496 times.
|
734 | if(d2>=left) |
| 15216 | { | ||
| 15217 | 496 | dir=d2; | |
| 15218 | 496 | } | |
| 15219 | |||
| 15220 |
2/2✓ Branch 0 taken 342 times.
✓ Branch 1 taken 392 times.
|
734 | if(dmisc1) |
| 15221 | { | ||
| 15222 |
2/2✓ Branch 0 taken 308 times.
✓ Branch 1 taken 34 times.
|
342 | if(x<=40) |
| 15223 | { | ||
| 15224 | 34 | dir=right; | |
| 15225 | 34 | } | |
| 15226 | |||
| 15227 |
1/2✓ Branch 0 taken 342 times.
✗ Branch 1 not taken.
|
342 | if(x>=104) |
| 15228 | { | ||
| 15229 | ✗ | dir=left; | |
| 15230 | ✗ | } | |
| 15231 | 342 | } | |
| 15232 | else | ||
| 15233 | { | ||
| 15234 |
2/2✓ Branch 0 taken 378 times.
✓ Branch 1 taken 14 times.
|
392 | if(x<=136) |
| 15235 | { | ||
| 15236 | 14 | dir=right; | |
| 15237 | 14 | } | |
| 15238 | |||
| 15239 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 17 times.
|
392 | if(x>=200) |
| 15240 | { | ||
| 15241 | 17 | dir=left; | |
| 15242 | 17 | } | |
| 15243 | } | ||
| 15244 | 734 | } | |
| 15245 | |||
| 15246 |
4/4✓ Branch 0 taken 44824 times.
✓ Branch 1 taken 1090 times.
✓ Branch 2 taken 39189 times.
✓ Branch 3 taken 5635 times.
|
45914 | if(clk4>=-1 && !((clk4+1)&7)) |
| 15247 | { | ||
| 15248 |
2/2✓ Branch 0 taken 2991 times.
✓ Branch 1 taken 2644 times.
|
5635 | if(dir==left) |
| 15249 | { | ||
| 15250 | 2991 | x-=1; | |
| 15251 | 2991 | } | |
| 15252 | else | ||
| 15253 | { | ||
| 15254 | 2644 | x+=1; | |
| 15255 | } | ||
| 15256 | 5635 | } | |
| 15257 | |||
| 15258 | 45914 | clk4=(clk4+1)%256; | |
| 15259 | |||
| 15260 | 45914 | return enemy::animate(index); | |
| 15261 | 47152 | } | |
| 15262 | |||
| 15263 | 47563 | void eAquamentus::draw(BITMAP *dest) | |
| 15264 | { | ||
| 15265 |
2/2✓ Branch 0 taken 26079 times.
✓ Branch 1 taken 21484 times.
|
47563 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 15266 | { | ||
| 15267 | 26079 | xofs=(dmisc1?-16:0); | |
| 15268 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 26079 times.
✓ Branch 2 taken 10724 times.
✓ Branch 3 taken 15355 times.
|
26079 | if ( do_animation ) tile=o_tile+((clk&24)>>2)+(clk3>-32?(clk3>0?40:80):0); |
| 15269 | |||
| 15270 |
2/2✓ Branch 0 taken 662 times.
✓ Branch 1 taken 25417 times.
|
26079 | if(dying) |
| 15271 | { | ||
| 15272 | 662 | xofs=0; | |
| 15273 | 662 | enemy::draw(dest); | |
| 15274 | 662 | } | |
| 15275 | else | ||
| 15276 | { | ||
| 15277 | 25417 | drawblock(dest,15); | |
| 15278 | } | ||
| 15279 | 26079 | } | |
| 15280 | else | ||
| 15281 | { | ||
| 15282 | 21484 | int32_t xblockofs=((dmisc1)?-16:16); | |
| 15283 | 21484 | xofs=0; | |
| 15284 | |||
| 15285 |
4/4✓ Branch 0 taken 20982 times.
✓ Branch 1 taken 502 times.
✓ Branch 2 taken 576 times.
✓ Branch 3 taken 20406 times.
|
21484 | if(clk<0 || dying) |
| 15286 | { | ||
| 15287 | 1078 | enemy::draw(dest); | |
| 15288 | 1078 | return; | |
| 15289 | } | ||
| 15290 |
1/2✓ Branch 0 taken 20406 times.
✗ Branch 1 not taken.
|
20406 | if ( do_animation ) |
| 15291 | { | ||
| 15292 | // face (0=firing, 2=resting) | ||
| 15293 | 20406 | tile=o_tile+((clk3>0)?0:2); | |
| 15294 | 20406 | enemy::draw(dest); | |
| 15295 | // tail ( | ||
| 15296 | 20406 | tile=o_tile+((clk&16)?1:3); | |
| 15297 | 20406 | xofs=xblockofs; | |
| 15298 | 20406 | enemy::draw(dest); | |
| 15299 | // body | ||
| 15300 | 20406 | yofs+=16; | |
| 15301 | 20406 | xofs=0; | |
| 15302 | 20406 | tile=o_tile+((clk&16)?20:22); | |
| 15303 | 20406 | enemy::draw(dest); | |
| 15304 | 20406 | xofs=xblockofs; | |
| 15305 | 20406 | tile=o_tile+((clk&16)?21:23); | |
| 15306 | 20406 | enemy::draw(dest); | |
| 15307 | 20406 | yofs-=16; | |
| 15308 | 20406 | } | |
| 15309 | ✗ | else enemy::draw(dest); | |
| 15310 | } | ||
| 15311 | 47563 | } | |
| 15312 | |||
| 15313 | 10091 | bool eAquamentus::hit(weapon *w) | |
| 15314 | { | ||
| 15315 |
3/6✓ Branch 0 taken 10091 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10091 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10091 times.
|
10091 | if(!(w->scriptcoldet&1) || w->fallclk || w->drownclk) return false; |
| 15316 | |||
| 15317 |
2/2✓ Branch 0 taken 2806 times.
✓ Branch 1 taken 7285 times.
|
10091 | switch(w->id) |
| 15318 | { | ||
| 15319 | case wBeam: | ||
| 15320 | case wRefBeam: | ||
| 15321 | case wMagic: | ||
| 15322 | 2806 | hysz=32; | |
| 15323 | 2806 | } | |
| 15324 | |||
| 15325 |
4/4✓ Branch 0 taken 9966 times.
✓ Branch 1 taken 125 times.
✓ Branch 2 taken 7827 times.
✓ Branch 3 taken 2139 times.
|
10091 | bool ret = (dying || hclk>0) ? false : sprite::hit(w); |
| 15326 | 10091 | hysz=16; | |
| 15327 | 10091 | return ret; | |
| 15328 | |||
| 15329 | 10091 | } | |
| 15330 | |||
| 15331 | 108 | eGohma::eGohma(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) // enemy((zfix)128,(zfix)48,Id,0) | |
| 15332 | 108 | { | |
| 15333 | |||
| 15334 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | if ( !(editorflags & ENEMY_FLAG5) ) |
| 15335 | { | ||
| 15336 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | x = 128; |
| 15337 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | y = 48; |
| 15338 | 54 | } | |
| 15339 | ✗ | else { x = X; y = Y; } | |
| 15340 | |||
| 15341 | 54 | Clk=Clk; | |
| 15342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
|
54 | if(flags & guy_fadeflicker) |
| 15343 | { | ||
| 15344 | ✗ | clk=0; | |
| 15345 | ✗ | superman = 1; | |
| 15346 | ✗ | fading=fade_flicker; | |
| 15347 | ✗ | if (!(editorflags&ENEMY_FLAG3)) count_enemy=false; | |
| 15348 | ✗ | } | |
| 15349 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 36 times.
|
54 | else if(flags & guy_fadeinstant) |
| 15350 | { | ||
| 15351 | 36 | clk=0; | |
| 15352 | 36 | } | |
| 15353 | 54 | hxofs=-16; | |
| 15354 | 54 | hxsz=48; | |
| 15355 | 54 | clk4=0; | |
| 15356 |
3/6✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 54 times.
✓ Branch 4 taken 54 times.
✗ Branch 5 not taken.
|
54 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset)+1; |
| 15357 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | dir=zc_oldrand()%3+1; |
| 15358 | 54 | SIZEflags = d->SIZEflags; | |
| 15359 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
54 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 15360 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 15361 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 15362 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
54 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = tysz; if ( tysz > 1 ) extend = 3; } |
| 15363 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
54 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = hxsz; |
| 15364 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
54 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = hysz; |
| 15365 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
54 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = hzsz; |
| 15366 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = hxofs; |
| 15367 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = hyofs; |
| 15368 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 15369 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
54 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)xofs; |
| 15370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
|
54 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 15371 | { | ||
| 15372 | ✗ | yofs = (int32_t)yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 15373 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 15374 | ✗ | } | |
| 15375 | |||
| 15376 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
54 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)zofs; |
| 15377 | |||
| 15378 | //nets+5340; | ||
| 15379 | 54 | } | |
| 15380 | |||
| 15381 | 46467 | bool eGohma::animate(int32_t index) | |
| 15382 | { | ||
| 15383 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46467 times.
|
46467 | if(switch_hooked) return enemy::animate(index); |
| 15384 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 45711 times.
|
46467 | if(dying) |
| 15385 | 756 | return Dead(index); | |
| 15386 | |||
| 15387 |
2/2✓ Branch 0 taken 45701 times.
✓ Branch 1 taken 10 times.
|
45711 | if(fading) |
| 15388 | { | ||
| 15389 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if(++clk4 > 60) |
| 15390 | { | ||
| 15391 | 10 | clk4=0; | |
| 15392 | 10 | superman=0; | |
| 15393 | 10 | fading=0; | |
| 15394 | 10 | clk=0; | |
| 15395 | |||
| 15396 | 10 | } | |
| 15397 | ✗ | else return enemy::animate(index); | |
| 15398 | 10 | } | |
| 15399 | |||
| 15400 |
2/2✓ Branch 0 taken 45497 times.
✓ Branch 1 taken 214 times.
|
45711 | if(clk==0) |
| 15401 | { | ||
| 15402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 214 times.
|
214 | if (ffcactivated) removearmosffc(ffcactivated-1); |
| 15403 | else | ||
| 15404 | { | ||
| 15405 |
1/2✓ Branch 0 taken 214 times.
✗ Branch 1 not taken.
|
214 | removearmos(zc_max(x-16, zfix(0)),y); |
| 15406 | 214 | did_armos = false; | |
| 15407 | 214 | removearmos(x,y); | |
| 15408 | 214 | did_armos = false; | |
| 15409 |
1/2✓ Branch 0 taken 214 times.
✗ Branch 1 not taken.
|
214 | removearmos(zc_min(x+16, zfix(255)),y); |
| 15410 | } | ||
| 15411 | 214 | } | |
| 15412 | |||
| 15413 |
2/2✓ Branch 0 taken 45438 times.
✓ Branch 1 taken 273 times.
|
45711 | if(clk<0) return enemy::animate(index); |
| 15414 | |||
| 15415 | // Movement clk must be separate from animation clk because of the Clock item | ||
| 15416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45438 times.
|
45438 | if(!watch) |
| 15417 | 45438 | clk4++; | |
| 15418 | |||
| 15419 |
2/2✓ Branch 0 taken 44754 times.
✓ Branch 1 taken 684 times.
|
45438 | if((clk4&63)==0) |
| 15420 | { | ||
| 15421 |
2/2✓ Branch 0 taken 357 times.
✓ Branch 1 taken 327 times.
|
684 | if(clk4&64) |
| 15422 | 357 | dir^=1; | |
| 15423 | else | ||
| 15424 | 327 | dir=zc_oldrand()%3+1; | |
| 15425 | 684 | } | |
| 15426 | |||
| 15427 |
2/2✓ Branch 0 taken 44705 times.
✓ Branch 1 taken 733 times.
|
45438 | if((clk&63)==3) |
| 15428 | { | ||
| 15429 |
2/2✓ Branch 0 taken 546 times.
✓ Branch 1 taken 187 times.
|
733 | switch(dmisc1) |
| 15430 | { | ||
| 15431 | case 1: | ||
| 15432 | 187 | addEwpn(x,y+2,z,wpn,3,wdp,left,getUID(), 0, fakez); | |
| 15433 | 187 | addEwpn(x,y+2,z,wpn,3,wdp,8,getUID(), 0, fakez); | |
| 15434 | 187 | addEwpn(x,y+2,z,wpn,3,wdp,right,getUID(), 0, fakez); | |
| 15435 | 187 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 15436 | 187 | break; | |
| 15437 | |||
| 15438 | default: | ||
| 15439 |
3/4✓ Branch 0 taken 546 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
✓ Branch 3 taken 461 times.
|
546 | if(dmisc1 != 1 && dmisc1 != 2) |
| 15440 | { | ||
| 15441 | 461 | addEwpn(x,y+2,z,wpn,3,wdp,8,getUID(), 0, fakez); | |
| 15442 | 461 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 15443 | 461 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 15444 | 461 | } | |
| 15445 | |||
| 15446 | 546 | break; | |
| 15447 | } | ||
| 15448 | 733 | } | |
| 15449 | |||
| 15450 |
6/6✓ Branch 0 taken 5356 times.
✓ Branch 1 taken 40082 times.
✓ Branch 2 taken 5084 times.
✓ Branch 3 taken 272 times.
✓ Branch 4 taken 3692 times.
✓ Branch 5 taken 1392 times.
|
45438 | if((dmisc1 == 2)&& clk3>=16 && clk3<116) |
| 15451 | { | ||
| 15452 |
2/2✓ Branch 0 taken 183 times.
✓ Branch 1 taken 1209 times.
|
1392 | if(!(clk3%8)) |
| 15453 | { | ||
| 15454 | 183 | FireBreath(true); | |
| 15455 | 183 | } | |
| 15456 | 1392 | } | |
| 15457 | |||
| 15458 |
2/2✓ Branch 0 taken 22700 times.
✓ Branch 1 taken 22738 times.
|
45438 | if(clk4&1) |
| 15459 | 22738 | move((zfix)1); | |
| 15460 | |||
| 15461 |
2/2✓ Branch 0 taken 45338 times.
✓ Branch 1 taken 100 times.
|
45438 | if(++clk3>=400) |
| 15462 | 100 | clk3=0; | |
| 15463 | |||
| 15464 | 45438 | return enemy::animate(index); | |
| 15465 | 46467 | } | |
| 15466 | |||
| 15467 | 46465 | void eGohma::draw(BITMAP *dest) | |
| 15468 | { | ||
| 15469 | 46465 | tile=o_tile; | |
| 15470 | |||
| 15471 |
4/4✓ Branch 0 taken 46192 times.
✓ Branch 1 taken 273 times.
✓ Branch 2 taken 756 times.
✓ Branch 3 taken 45436 times.
|
46465 | if(clk<0 || dying) |
| 15472 | { | ||
| 15473 | 1029 | enemy::drawzcboss(dest); | |
| 15474 | 1029 | return; | |
| 15475 | } | ||
| 15476 | |||
| 15477 |
2/2✓ Branch 0 taken 33103 times.
✓ Branch 1 taken 12333 times.
|
45436 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 15478 | { | ||
| 15479 | ///if ( do_animation ) | ||
| 15480 | //Yuck. Gohma can just not have this capability right now. | ||
| 15481 | // left side | ||
| 15482 | 33103 | xofs=-16; | |
| 15483 | 33103 | flip=0; | |
| 15484 | // if(clk&16) tile=180; | ||
| 15485 | // else { tile=182; flip=1; } | ||
| 15486 | 33103 | tile+=(3*((clk&48)>>4)); | |
| 15487 | 33103 | enemy::drawzcboss(dest); | |
| 15488 | |||
| 15489 | // right side | ||
| 15490 | 33103 | xofs=16; | |
| 15491 | // tile=(180+182)-tile; | ||
| 15492 | 33103 | tile=o_tile; | |
| 15493 | 33103 | tile+=(3*((clk&48)>>4))+2; | |
| 15494 | 33103 | enemy::drawzcboss(dest); | |
| 15495 | |||
| 15496 | // body | ||
| 15497 | 33103 | xofs=0; //Gohma may need more adjustments for SIZEflags. -Z 14 Aug 2020 | |
| 15498 | 33103 | tile=o_tile; | |
| 15499 | |||
| 15500 | // tile+=(3*((clk&24)>>3))+2; | ||
| 15501 |
2/2✓ Branch 0 taken 1743 times.
✓ Branch 1 taken 31360 times.
|
33103 | if(clk3<16) |
| 15502 | 1743 | tile+=7; | |
| 15503 |
2/2✓ Branch 0 taken 9362 times.
✓ Branch 1 taken 21998 times.
|
31360 | else if(clk3<116) |
| 15504 | 9362 | tile+=10; | |
| 15505 |
2/2✓ Branch 0 taken 1315 times.
✓ Branch 1 taken 20683 times.
|
21998 | else if(clk3<132) |
| 15506 | 1315 | tile+=7; | |
| 15507 | else | ||
| 15508 | 20683 | tile+=((clk3-132)&24)?4:1; | |
| 15509 | |||
| 15510 | 33103 | enemy::drawzcboss(dest); | |
| 15511 | |||
| 15512 | 33103 | } | |
| 15513 | else | ||
| 15514 | { | ||
| 15515 | // left side | ||
| 15516 | 12333 | xofs=-16; | |
| 15517 | 12333 | flip=0; | |
| 15518 | |||
| 15519 |
2/2✓ Branch 0 taken 6107 times.
✓ Branch 1 taken 6226 times.
|
12333 | if(!(clk&16)) |
| 15520 | { | ||
| 15521 | 6226 | tile+=2; | |
| 15522 | 6226 | flip=1; | |
| 15523 | 6226 | } | |
| 15524 | |||
| 15525 | 12333 | enemy::draw(dest); | |
| 15526 | |||
| 15527 | // right side | ||
| 15528 | 12333 | tile=o_tile; | |
| 15529 | 12333 | xofs=16; | |
| 15530 | |||
| 15531 |
2/2✓ Branch 0 taken 6226 times.
✓ Branch 1 taken 6107 times.
|
12333 | if((clk&16)) tile+=2; |
| 15532 | |||
| 15533 | // tile=(180+182)-tile; | ||
| 15534 | 12333 | enemy::draw(dest); | |
| 15535 | |||
| 15536 | // body | ||
| 15537 | 12333 | tile=o_tile; | |
| 15538 | 12333 | xofs=0; | |
| 15539 | |||
| 15540 |
2/2✓ Branch 0 taken 720 times.
✓ Branch 1 taken 11613 times.
|
12333 | if(clk3<16) |
| 15541 | 720 | tile+=4; | |
| 15542 |
2/2✓ Branch 0 taken 3884 times.
✓ Branch 1 taken 7729 times.
|
11613 | else if(clk3<116) |
| 15543 | 3884 | tile+=5; | |
| 15544 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 7256 times.
|
7729 | else if(clk3<132) |
| 15545 | 473 | tile+=4; | |
| 15546 | 7256 | else tile+=((clk3-132)&8)?3:1; | |
| 15547 | |||
| 15548 | 12333 | enemy::draw(dest); | |
| 15549 | |||
| 15550 | } | ||
| 15551 | 46465 | } | |
| 15552 | |||
| 15553 | 229 | int32_t eGohma::takehit(weapon *w, weapon* realweap) | |
| 15554 | { | ||
| 15555 | 229 | int32_t wpnId = w->id; | |
| 15556 | 229 | int32_t power = w->power; | |
| 15557 | 229 | int32_t wpnx = w->x; | |
| 15558 | 229 | int32_t wpnDir = w->dir; | |
| 15559 | 229 | int32_t def = defenditemclassNew(wpnId, &power, w, realweap); | |
| 15560 | |||
| 15561 |
2/2✓ Branch 0 taken 121 times.
✓ Branch 1 taken 108 times.
|
229 | if(def < 0) |
| 15562 | { | ||
| 15563 |
7/10✗ Branch 0 not taken.
✓ Branch 1 taken 108 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 81 times.
✓ Branch 5 taken 27 times.
✓ Branch 6 taken 80 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 67 times.
✓ Branch 9 taken 13 times.
|
108 | if(!((wpnDir==up || wpnDir==l_up || wpnDir==r_up) && abs(int32_t(x)-wpnx)<=8 && clk3>=16 && clk3<116)) |
| 15564 | { | ||
| 15565 | 41 | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 15566 | 41 | return 1; | |
| 15567 | } | ||
| 15568 | 67 | } | |
| 15569 | |||
| 15570 | 188 | return enemy::takehit(w, realweap); | |
| 15571 | 229 | } | |
| 15572 | |||
| 15573 | 396 | eLilDig::eLilDig(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 15574 | 396 | { | |
| 15575 | 198 | count_enemy=(id==(id&0xFFF)); | |
| 15576 | //nets+4360+(((id&0xFF)-eDIGPUP2)*40); | ||
| 15577 | 198 | SIZEflags = d->SIZEflags; | |
| 15578 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
198 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 15579 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 15580 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 15581 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
198 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 15582 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
198 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 15583 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
198 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 15584 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
198 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 15585 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 15586 |
1/2✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
|
198 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 15587 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 15588 |
1/4✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
198 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 15589 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
|
198 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 15590 | { | ||
| 15591 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 15592 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 15593 | ✗ | } | |
| 15594 | |||
| 15595 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
198 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 15596 | 198 | } | |
| 15597 | |||
| 15598 | 75067 | bool eLilDig::animate(int32_t index) | |
| 15599 | { | ||
| 15600 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 75067 times.
|
75067 | if(switch_hooked) return enemy::animate(index); |
| 15601 |
2/2✓ Branch 0 taken 3006 times.
✓ Branch 1 taken 72061 times.
|
75067 | if(dying) |
| 15602 | 3006 | return Dead(index); | |
| 15603 | |||
| 15604 |
2/2✓ Branch 0 taken 4113 times.
✓ Branch 1 taken 67948 times.
|
72061 | if(clk==0) |
| 15605 | { | ||
| 15606 | 4113 | removearmos(x,y,ffcactivated); | |
| 15607 | 4113 | } | |
| 15608 | |||
| 15609 |
2/2✓ Branch 0 taken 48439 times.
✓ Branch 1 taken 23622 times.
|
72061 | if(misc<=128) |
| 15610 | { | ||
| 15611 |
2/2✓ Branch 0 taken 711 times.
✓ Branch 1 taken 22911 times.
|
23622 | if(!(++misc&31)) |
| 15612 | 711 | step+=0.25; | |
| 15613 | 23622 | } | |
| 15614 | |||
| 15615 | 72061 | variable_walk_8(rate,homing,hrate,spw_floater); | |
| 15616 | 72061 | return enemy::animate(index); | |
| 15617 | 75067 | } | |
| 15618 | |||
| 15619 | 74914 | void eLilDig::draw(BITMAP *dest) | |
| 15620 | { | ||
| 15621 | 74914 | tile = o_tile; | |
| 15622 | // tile = 160; | ||
| 15623 | 74914 | int32_t fdiv = frate/4; | |
| 15624 |
1/2✓ Branch 0 taken 74914 times.
✗ Branch 1 not taken.
|
74914 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 15625 |
2/2✓ Branch 0 taken 46311 times.
✓ Branch 1 taken 28603 times.
|
74914 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 15626 | 74914 | efrate:((clk>=(frate>>1))?1:0); | |
| 15627 | |||
| 15628 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74914 times.
|
74914 | if ( do_animation ) |
| 15629 | { | ||
| 15630 |
2/2✓ Branch 0 taken 46311 times.
✓ Branch 1 taken 28603 times.
|
74914 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 15631 | { | ||
| 15632 |
9/9✓ Branch 0 taken 5853 times.
✓ Branch 1 taken 5465 times.
✓ Branch 2 taken 5245 times.
✓ Branch 3 taken 5717 times.
✓ Branch 4 taken 5242 times.
✓ Branch 5 taken 4505 times.
✓ Branch 6 taken 3937 times.
✓ Branch 7 taken 5035 times.
✓ Branch 8 taken 5312 times.
|
46311 | switch(dir-8) //directions get screwed up after 8. *shrug* |
| 15633 | { | ||
| 15634 | case up: //u | ||
| 15635 | 5853 | flip=0; | |
| 15636 | 5853 | break; | |
| 15637 | |||
| 15638 | case l_up: //d | ||
| 15639 | 5465 | flip=0; | |
| 15640 | 5465 | tile+=4; | |
| 15641 | 5465 | break; | |
| 15642 | |||
| 15643 | case l_down: //l | ||
| 15644 | 5245 | flip=0; | |
| 15645 | 5245 | tile+=8; | |
| 15646 | 5245 | break; | |
| 15647 | |||
| 15648 | case left: //r | ||
| 15649 | 5717 | flip=0; | |
| 15650 | 5717 | tile+=12; | |
| 15651 | 5717 | break; | |
| 15652 | |||
| 15653 | case r_down: //ul | ||
| 15654 | 5242 | flip=0; | |
| 15655 | 5242 | tile+=20; | |
| 15656 | 5242 | break; | |
| 15657 | |||
| 15658 | case down: //ur | ||
| 15659 | 4505 | flip=0; | |
| 15660 | 4505 | tile+=24; | |
| 15661 | 4505 | break; | |
| 15662 | |||
| 15663 | case r_up: //dl | ||
| 15664 | 3937 | flip=0; | |
| 15665 | 3937 | tile+=28; | |
| 15666 | 3937 | break; | |
| 15667 | |||
| 15668 | case right: //dr | ||
| 15669 | 5035 | flip=0; | |
| 15670 | 5035 | tile+=32; | |
| 15671 | 5035 | break; | |
| 15672 | } | ||
| 15673 | |||
| 15674 | 46311 | tile+=f2; | |
| 15675 | 46311 | } | |
| 15676 | else | ||
| 15677 | { | ||
| 15678 | 28603 | tile+=(clk>=6)?1:0; | |
| 15679 | } | ||
| 15680 | 74914 | } | |
| 15681 | |||
| 15682 | 74914 | enemy::draw(dest); | |
| 15683 | 74914 | } | |
| 15684 | |||
| 15685 | 104 | eBigDig::eBigDig(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 15686 | 104 | { | |
| 15687 | 52 | superman=1; | |
| 15688 | |||
| 15689 | 52 | SIZEflags = d->SIZEflags; | |
| 15690 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 15691 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 15692 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 15693 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 15694 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 15695 | 52 | else hxsz=32; | |
| 15696 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 15697 | 52 | else hysz=32; | |
| 15698 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 15699 | 52 | else hzsz=16; // hard to jump. | |
| 15700 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 15701 | 52 | else hxofs=-8; | |
| 15702 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 15703 | 52 | else hyofs=-8; | |
| 15704 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 15705 |
1/4✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 15706 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 15707 | { | ||
| 15708 | ✗ | yofs = d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 15709 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 15710 | ✗ | } | |
| 15711 | |||
| 15712 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 15713 | |||
| 15714 | |||
| 15715 | 52 | } | |
| 15716 | |||
| 15717 | 22457 | bool eBigDig::animate(int32_t index) | |
| 15718 | { | ||
| 15719 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22457 times.
|
22457 | if(switch_hooked) return enemy::animate(index); |
| 15720 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22457 times.
|
22457 | if(dying) |
| 15721 | ✗ | return Dead(index); | |
| 15722 | |||
| 15723 |
2/2✓ Branch 0 taken 19263 times.
✓ Branch 1 taken 3194 times.
|
22457 | if(clk==0) |
| 15724 | { | ||
| 15725 | 3194 | removearmos(x,y,ffcactivated); | |
| 15726 | 3194 | } | |
| 15727 | |||
| 15728 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 22369 times.
✓ Branch 2 taken 44 times.
✓ Branch 3 taken 44 times.
|
22457 | switch(misc) |
| 15729 | { | ||
| 15730 | case 0: | ||
| 15731 | 22369 | variable_walk_8(rate,homing,hrate,spw_floater,-8,-16,23,23); | |
| 15732 | 22369 | break; | |
| 15733 | |||
| 15734 | case 1: | ||
| 15735 | 44 | ++misc; | |
| 15736 | 44 | break; | |
| 15737 | |||
| 15738 | case 2: | ||
| 15739 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 44 times.
|
149 | for(int32_t i=0; i<dmisc5; i++) |
| 15740 | { | ||
| 15741 | 105 | addenemy(x,y,dmisc1+0x1000,-15); | |
| 15742 | 105 | } | |
| 15743 | |||
| 15744 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 44 times.
|
60 | for(int32_t i=0; i<dmisc6; i++) |
| 15745 | { | ||
| 15746 | 16 | addenemy(x,y,dmisc2+0x1000,-15); | |
| 15747 | 16 | } | |
| 15748 | |||
| 15749 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 44 times.
|
60 | for(int32_t i=0; i<dmisc7; i++) |
| 15750 | { | ||
| 15751 | 16 | addenemy(x,y,dmisc3+0x1000,-15); | |
| 15752 | 16 | } | |
| 15753 | |||
| 15754 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 44 times.
|
60 | for(int32_t i=0; i<dmisc8; i++) |
| 15755 | { | ||
| 15756 | 16 | addenemy(x,y,dmisc4+0x1000,-15); | |
| 15757 | 16 | } | |
| 15758 | |||
| 15759 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 1 times.
|
44 | if(itemguy) // Hand down the carried item |
| 15760 | { | ||
| 15761 | 1 | guycarryingitem = guys.Count()-1; | |
| 15762 | 1 | ((enemy*)guys.spr(guycarryingitem))->itemguy = true; | |
| 15763 | 1 | itemguy = false; | |
| 15764 | 1 | } | |
| 15765 | |||
| 15766 | 44 | stop_bgsfx(index); | |
| 15767 | |||
| 15768 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if(deadsfx > 0) sfx(deadsfx,pan(int32_t(x))); |
| 15769 | |||
| 15770 | 44 | return true; | |
| 15771 | } | ||
| 15772 | |||
| 15773 | 22413 | return enemy::animate(index); | |
| 15774 | 22457 | } | |
| 15775 | |||
| 15776 | 22452 | void eBigDig::draw(BITMAP *dest) | |
| 15777 | { | ||
| 15778 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22452 times.
|
22452 | if(anim!=aDIG) |
| 15779 | { | ||
| 15780 | ✗ | update_enemy_frame(); | |
| 15781 | ✗ | xofs-=8; | |
| 15782 | ✗ | yofs-=8; | |
| 15783 | ✗ | drawblock(dest,15); | |
| 15784 | ✗ | xofs+=8; | |
| 15785 | ✗ | yofs+=8; | |
| 15786 | ✗ | return; | |
| 15787 | } | ||
| 15788 | |||
| 15789 | 22452 | tile = o_tile; | |
| 15790 | 22452 | int32_t fdiv = frate/4; | |
| 15791 |
1/2✓ Branch 0 taken 22452 times.
✗ Branch 1 not taken.
|
22452 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 15792 | |||
| 15793 |
2/2✓ Branch 0 taken 10238 times.
✓ Branch 1 taken 12214 times.
|
22452 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 15794 | 22452 | efrate:((clk>=(frate>>1))?1:0); | |
| 15795 | |||
| 15796 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22452 times.
|
22452 | if ( do_animation ) |
| 15797 | { | ||
| 15798 |
2/2✓ Branch 0 taken 10238 times.
✓ Branch 1 taken 12214 times.
|
22452 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 15799 | { | ||
| 15800 |
9/9✓ Branch 0 taken 1115 times.
✓ Branch 1 taken 1221 times.
✓ Branch 2 taken 1344 times.
✓ Branch 3 taken 1195 times.
✓ Branch 4 taken 1233 times.
✓ Branch 5 taken 1223 times.
✓ Branch 6 taken 993 times.
✓ Branch 7 taken 1450 times.
✓ Branch 8 taken 464 times.
|
10238 | switch(dir-8) //directions get screwed up after 8. *shrug* |
| 15801 | { | ||
| 15802 | case up: //u | ||
| 15803 | 1115 | flip=0; | |
| 15804 | 1115 | break; | |
| 15805 | |||
| 15806 | case l_up: //d | ||
| 15807 | 1221 | flip=0; | |
| 15808 | 1221 | tile+=8; | |
| 15809 | 1221 | break; | |
| 15810 | |||
| 15811 | case l_down: //l | ||
| 15812 | 1344 | flip=0; | |
| 15813 | 1344 | tile+=40; | |
| 15814 | 1344 | break; | |
| 15815 | |||
| 15816 | case left: //r | ||
| 15817 | 1195 | flip=0; | |
| 15818 | 1195 | tile+=48; | |
| 15819 | 1195 | break; | |
| 15820 | |||
| 15821 | case r_down: //ul | ||
| 15822 | 1233 | flip=0; | |
| 15823 | 1233 | tile+=80; | |
| 15824 | 1233 | break; | |
| 15825 | |||
| 15826 | case down: //ur | ||
| 15827 | 1223 | flip=0; | |
| 15828 | 1223 | tile+=88; | |
| 15829 | |||
| 15830 | 1223 | break; | |
| 15831 | |||
| 15832 | case r_up: //dl | ||
| 15833 | 993 | flip=0; | |
| 15834 | 993 | tile+=120; | |
| 15835 | 993 | break; | |
| 15836 | |||
| 15837 | case right: //dr | ||
| 15838 | 1450 | flip=0; | |
| 15839 | 1450 | tile+=128; | |
| 15840 | 1450 | break; | |
| 15841 | } | ||
| 15842 | |||
| 15843 | 10238 | tile+=(f2*2); | |
| 15844 | 10238 | } | |
| 15845 | else | ||
| 15846 | { | ||
| 15847 | 12214 | tile+=(f2)?0:2; | |
| 15848 | 12214 | flip=(clk&1)?1:0; | |
| 15849 | } | ||
| 15850 | 22452 | } | |
| 15851 | |||
| 15852 | 22452 | xofs-=8; | |
| 15853 | 22452 | yofs-=8; | |
| 15854 | 22452 | drawblock(dest,15); | |
| 15855 | 22452 | xofs+=8; | |
| 15856 | 22452 | yofs+=8; | |
| 15857 | 22452 | } | |
| 15858 | |||
| 15859 | 740 | int32_t eBigDig::takehit(weapon *w, weapon* realweap) | |
| 15860 | { | ||
| 15861 | 740 | int32_t wpnId = w->id; | |
| 15862 | |||
| 15863 |
3/4✓ Branch 0 taken 44 times.
✓ Branch 1 taken 696 times.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
|
740 | if(wpnId==wWhistle && misc==0) |
| 15864 | 44 | misc=1; | |
| 15865 | |||
| 15866 | 740 | return 0; | |
| 15867 | } | ||
| 15868 | |||
| 15869 | /* | ||
| 15870 | eGanon::eGanon(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | ||
| 15871 | { | ||
| 15872 | hxofs=hyofs=8; | ||
| 15873 | hzsz=16; //can't be jumped. | ||
| 15874 | clk2=70; | ||
| 15875 | misc=-1; | ||
| 15876 | mainguy=!getmapflag(); | ||
| 15877 | } | ||
| 15878 | |||
| 15879 | bool eGanon::animate(int32_t index) | ||
| 15880 | { | ||
| 15881 | if(switch_hooked) return enemy::animate(index); | ||
| 15882 | if(dying) | ||
| 15883 | |||
| 15884 | return Dead(index); | ||
| 15885 | |||
| 15886 | if(clk==0) | ||
| 15887 | { | ||
| 15888 | removearmos(x,y,ffcactivated); | ||
| 15889 | } | ||
| 15890 | |||
| 15891 | switch(misc) | ||
| 15892 | { | ||
| 15893 | case -1: | ||
| 15894 | misc=0; | ||
| 15895 | |||
| 15896 | case 0: | ||
| 15897 | if(++clk2>72 && !(zc_oldrand()&3)) | ||
| 15898 | { | ||
| 15899 | addEwpn(x,y,z,wpn,3,wdp,dir,getUID()); | ||
| 15900 | sfx(wpnsfx(wpn),pan(int32_t(x))); | ||
| 15901 | clk2=0; | ||
| 15902 | } | ||
| 15903 | |||
| 15904 | Stunclk=0; | ||
| 15905 | constant_walk(rate,homing,spw_none); | ||
| 15906 | break; | ||
| 15907 | |||
| 15908 | case 1: | ||
| 15909 | case 2: | ||
| 15910 | if(--Stunclk<=0) | ||
| 15911 | { | ||
| 15912 | int32_t r=zc_oldrand(); | ||
| 15913 | |||
| 15914 | if(r&1) | ||
| 15915 | { | ||
| 15916 | y=96; | ||
| 15917 | |||
| 15918 | if(r&2) | ||
| 15919 | x=160; | ||
| 15920 | else | ||
| 15921 | x=48; | ||
| 15922 | |||
| 15923 | if(tooclose(x,y,48)) | ||
| 15924 | x=208-x; | ||
| 15925 | } | ||
| 15926 | |||
| 15927 | //if ( editorflags & ENEMY_FLAG15 && current_item_id(itype_amulet,false) >= 2 ) //visible to Amulet 2 | ||
| 15928 | //{ | ||
| 15929 | // loadpalset(9,pSprite(spBROWN)); //make Ganon visible? | ||
| 15930 | // } | ||
| 15931 | // else | ||
| 15932 | // { | ||
| 15933 | loadpalset(csBOSS,pSprite(d->bosspal)); | ||
| 15934 | // } | ||
| 15935 | misc=0; | ||
| 15936 | } | ||
| 15937 | |||
| 15938 | break; | ||
| 15939 | |||
| 15940 | case 3: | ||
| 15941 | { | ||
| 15942 | if(hclk>0) | ||
| 15943 | break; | ||
| 15944 | |||
| 15945 | misc=4; | ||
| 15946 | clk=0; | ||
| 15947 | hxofs=1000; | ||
| 15948 | loadpalset(9,pSprite(spPILE)); | ||
| 15949 | music_stop(); | ||
| 15950 | stop_sfx(WAV_ROAR); | ||
| 15951 | |||
| 15952 | if(deadsfx>0) sfx(deadsfx,pan(int32_t(x))); | ||
| 15953 | |||
| 15954 | sfx(WAV_GANON); | ||
| 15955 | //Ganon's dustpile; fall in sideview. -Z | ||
| 15956 | item *dustpile = new item(x+8,y+8,(zfix)0,iPile,ipDUMMY,0); | ||
| 15957 | dustpile->linked_parent = eeGANON; | ||
| 15958 | setmapflag(); | ||
| 15959 | //items.add(new item(x+8,y+8,(zfix)0,iPile,ipDUMMY,0)); | ||
| 15960 | break; | ||
| 15961 | } | ||
| 15962 | |||
| 15963 | case 4: | ||
| 15964 | if(clk>=80) | ||
| 15965 | { | ||
| 15966 | misc=5; | ||
| 15967 | |||
| 15968 | if(getmapflag()) | ||
| 15969 | { | ||
| 15970 | game->lvlitems[dlevel]|=liBOSS; | ||
| 15971 | //play_DmapMusic(); | ||
| 15972 | playLevelMusic(); | ||
| 15973 | return true; | ||
| 15974 | } | ||
| 15975 | |||
| 15976 | sfx(WAV_CLEARED); | ||
| 15977 | items.add(new item(x+8,y+8,(zfix)0,iBigTri,ipBIGTRI,0)); | ||
| 15978 | setmapflag(); | ||
| 15979 | } | ||
| 15980 | |||
| 15981 | break; | ||
| 15982 | } | ||
| 15983 | |||
| 15984 | //if ( editorflags & ENEMY_FLAG15 ) //visible to Amulet 2 | ||
| 15985 | //{ | ||
| 15986 | //if ( current_item_id(itype_amulet,false) >= 2 ) | ||
| 15987 | //{ | ||
| 15988 | /// loadpalset(9,pSprite(spBROWN)); //make Ganon visible? | ||
| 15989 | //} | ||
| 15990 | //} | ||
| 15991 | |||
| 15992 | |||
| 15993 | return enemy::animate(index); | ||
| 15994 | } | ||
| 15995 | |||
| 15996 | |||
| 15997 | int32_t eGanon::takehit(weapon *w, weapon* realweap) | ||
| 15998 | { | ||
| 15999 | //these are here to bypass compiler warnings about unused arguments | ||
| 16000 | int32_t wpnId = w->id; | ||
| 16001 | int32_t power = w->power; | ||
| 16002 | int32_t enemyHitWeapon = w->parentitem; | ||
| 16003 | |||
| 16004 | switch(misc) | ||
| 16005 | { | ||
| 16006 | case 0: | ||
| 16007 | { | ||
| 16008 | //if we're not using the editor defences, and Ganon isn't hit by a sword, return. | ||
| 16009 | if(wpnId!=wSword && !(editorflags & ENEMY_FLAG14)) | ||
| 16010 | return 0; | ||
| 16011 | |||
| 16012 | //if we are not using the new defences, just reduce his HP | ||
| 16013 | if (!(editorflags & ENEMY_FLAG14)) | ||
| 16014 | { | ||
| 16015 | hp-=power; | ||
| 16016 | if(hp>0) | ||
| 16017 | { | ||
| 16018 | misc=1; | ||
| 16019 | Stunclk=64; | ||
| 16020 | } | ||
| 16021 | else | ||
| 16022 | { | ||
| 16023 | loadpalset(csBOSS,pSprite(spBROWN)); | ||
| 16024 | misc=2; | ||
| 16025 | Stunclk=284; | ||
| 16026 | hp=guysbuf[id&0xFFF].hp; //16*game->get_hero_dmgmult(); | ||
| 16027 | } | ||
| 16028 | |||
| 16029 | sfx(WAV_EHIT,pan(int32_t(x))); | ||
| 16030 | |||
| 16031 | if(hitsfx>0) sfx(hitsfx,pan(int32_t(x))); | ||
| 16032 | |||
| 16033 | return 1; | ||
| 16034 | } | ||
| 16035 | //otherwise, resolve his defence. | ||
| 16036 | else | ||
| 16037 | { | ||
| 16038 | int32_t def = enemy::takehit(w,realweap); //This works, but it instantly kills him if it does enough damage. | ||
| 16039 | if(hp>0) | ||
| 16040 | { | ||
| 16041 | misc=1; | ||
| 16042 | Stunclk=64; | ||
| 16043 | } | ||
| 16044 | else | ||
| 16045 | { | ||
| 16046 | loadpalset(csBOSS,pSprite(spBROWN)); | ||
| 16047 | misc=2; | ||
| 16048 | Stunclk=284; | ||
| 16049 | hp=guysbuf[id&0xFFF].hp; //16*game->get_hero_dmgmult(); | ||
| 16050 | } | ||
| 16051 | |||
| 16052 | sfx(WAV_EHIT,pan(int32_t(x))); | ||
| 16053 | |||
| 16054 | if(hitsfx>0) sfx(hitsfx,pan(int32_t(x))); | ||
| 16055 | |||
| 16056 | |||
| 16057 | return 1; | ||
| 16058 | } | ||
| 16059 | } | ||
| 16060 | case 2: | ||
| 16061 | { | ||
| 16062 | if | ||
| 16063 | ( | ||
| 16064 | ( dmisc14 > 0 && !enemyHitWeapon == dmisc14 ) //special weapon needed to kill ganon specified in editor | ||
| 16065 | || //or nothing specified, use silver arrows+ | ||
| 16066 | ( dmisc14 <= 0 && (wpnId!=wArrow || (enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_arrow))<4)) | ||
| 16067 | ) | ||
| 16068 | return 0; | ||
| 16069 | { | ||
| 16070 | misc=3; | ||
| 16071 | hclk=81; | ||
| 16072 | loadpalset(9,pSprite(spBROWN)); | ||
| 16073 | return 1; | ||
| 16074 | } | ||
| 16075 | |||
| 16076 | } | ||
| 16077 | } | ||
| 16078 | |||
| 16079 | return 0; | ||
| 16080 | } | ||
| 16081 | |||
| 16082 | void eGanon::draw(BITMAP *dest) | ||
| 16083 | { | ||
| 16084 | switch(misc) | ||
| 16085 | { | ||
| 16086 | case 0: | ||
| 16087 | if((clk&3)==3) | ||
| 16088 | tile=(zc_oldrand()%5)*2+o_tile; | ||
| 16089 | |||
| 16090 | if(db!=999) | ||
| 16091 | break; | ||
| 16092 | |||
| 16093 | case 2: | ||
| 16094 | if(Stunclk<64 && (Stunclk&1) ) | ||
| 16095 | { | ||
| 16096 | if | ||
| 16097 | ( | ||
| 16098 | ( (editorflags & ENEMY_FLAG1) && current_item_power(itype_amulet) >= 2 && (editorflags & ENEMY_FLAG15) ) | ||
| 16099 | || | ||
| 16100 | ( (editorflags & ENEMY_FLAG2) && (game->item[dmisc13]) && (editorflags & ENEMY_FLAG15) ) | ||
| 16101 | ) | ||
| 16102 | { | ||
| 16103 | goto ganon_draw; //draw his weapons if we can see him | ||
| 16104 | } | ||
| 16105 | break; | ||
| 16106 | } | ||
| 16107 | |||
| 16108 | case -1: | ||
| 16109 | tile=o_tile; | ||
| 16110 | |||
| 16111 | //fall through | ||
| 16112 | case 1: | ||
| 16113 | case 3: | ||
| 16114 | ganon_draw: | ||
| 16115 | drawblock(dest,15); | ||
| 16116 | break; | ||
| 16117 | |||
| 16118 | case 4: | ||
| 16119 | draw_guts(dest); | ||
| 16120 | draw_flash(dest); | ||
| 16121 | break; | ||
| 16122 | } | ||
| 16123 | |||
| 16124 | if ( editorflags & ENEMY_FLAG1 ) //visible to Amulet 2 | ||
| 16125 | { | ||
| 16126 | if | ||
| 16127 | ( | ||
| 16128 | ( (editorflags & ENEMY_FLAG1) && current_item_power(itype_amulet) >= 2 && (editorflags & ENEMY_FLAG15) ) | ||
| 16129 | || | ||
| 16130 | ( (editorflags & ENEMY_FLAG2) && (game->item[dmisc13]) && (editorflags & ENEMY_FLAG15) ) | ||
| 16131 | ) | ||
| 16132 | { | ||
| 16133 | draw_guts(dest); //makes his shots visible, but not him | ||
| 16134 | draw_flash(dest); | ||
| 16135 | } | ||
| 16136 | } | ||
| 16137 | } | ||
| 16138 | |||
| 16139 | void eGanon::draw_guts(BITMAP *dest) | ||
| 16140 | { | ||
| 16141 | int32_t c = zc_min(clk>>3,8); | ||
| 16142 | tile = clk<24 ? 74 : 75; | ||
| 16143 | overtile16(dest,tile,x+8,y+c+playing_field_offset,9,0); | ||
| 16144 | overtile16(dest,tile,x+8,y+16-c+playing_field_offset,9,0); | ||
| 16145 | overtile16(dest,tile,x+c,y+8+playing_field_offset,9,0); | ||
| 16146 | overtile16(dest,tile,x+16-c,y+8+playing_field_offset,9,0); | ||
| 16147 | overtile16(dest,tile,x+c,y+c+playing_field_offset,9,0); | ||
| 16148 | overtile16(dest,tile,x+16-c,y+c+playing_field_offset,9,0); | ||
| 16149 | overtile16(dest,tile,x+c,y+16-c+playing_field_offset,9,0); | ||
| 16150 | overtile16(dest,tile,x+16-c,y+16-c+playing_field_offset,9,0); | ||
| 16151 | } | ||
| 16152 | |||
| 16153 | void eGanon::draw_flash(BITMAP *dest) | ||
| 16154 | { | ||
| 16155 | |||
| 16156 | int32_t c = clk-(clk>>2); | ||
| 16157 | cs = (frame&3)+6; | ||
| 16158 | overtile16(dest,194,x+8,y+8-clk+playing_field_offset,cs,0); | ||
| 16159 | overtile16(dest,194,x+8,y+8+clk+playing_field_offset,cs,2); | ||
| 16160 | overtile16(dest,195,x+8-clk,y+8+playing_field_offset,cs,0); | ||
| 16161 | overtile16(dest,195,x+8+clk,y+8+playing_field_offset,cs,1); | ||
| 16162 | overtile16(dest,196,x+8-c,y+8-c+playing_field_offset,cs,0); | ||
| 16163 | overtile16(dest,196,x+8+c,y+8-c+playing_field_offset,cs,1); | ||
| 16164 | overtile16(dest,196,x+8-c,y+8+c+playing_field_offset,cs,2); | ||
| 16165 | overtile16(dest,196,x+8+c,y+8+c+playing_field_offset,cs,3); | ||
| 16166 | } | ||
| 16167 | */ | ||
| 16168 | |||
| 16169 | 18 | eGanon::eGanon(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 16170 | 18 | { | |
| 16171 | 9 | hxofs=hyofs=8; | |
| 16172 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | if (editorflags & ENEMY_FLAG3) |
| 16173 | { | ||
| 16174 | ✗ | hxofs = 4; | |
| 16175 | ✗ | hyofs = 4; | |
| 16176 | ✗ | hxsz = 24; | |
| 16177 | ✗ | hysz = 24; | |
| 16178 | ✗ | SIZEflags|=guyflagOVERRIDE_HIT_WIDTH; | |
| 16179 | ✗ | SIZEflags|=guyflagOVERRIDE_HIT_HEIGHT; | |
| 16180 | ✗ | } | |
| 16181 | 9 | hzsz=16; //can't be jumped. | |
| 16182 | 9 | clk2=70; | |
| 16183 | 9 | misc=-1; | |
| 16184 |
4/8✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
|
9 | mainguy=(!getmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr->flags9&fBELOWRETURN)); |
| 16185 | 9 | } | |
| 16186 | |||
| 16187 | 14182 | bool eGanon::animate(int32_t index) //DO NOT ADD a check for do_animation to this version of GANON!! -Z | |
| 16188 | { | ||
| 16189 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14182 times.
|
14182 | if(dying) |
| 16190 | |||
| 16191 | ✗ | return Dead(index); | |
| 16192 | |||
| 16193 |
2/2✓ Branch 0 taken 14126 times.
✓ Branch 1 taken 56 times.
|
14182 | if(clk==0) |
| 16194 | { | ||
| 16195 | 56 | removearmos(x,y,ffcactivated); | |
| 16196 | 56 | } | |
| 16197 | |||
| 16198 |
6/7✓ Branch 0 taken 2543 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10328 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 656 times.
✓ Branch 5 taken 640 times.
✓ Branch 6 taken 6 times.
|
14182 | switch(misc) |
| 16199 | { | ||
| 16200 | case -1: | ||
| 16201 | 9 | misc=0; | |
| 16202 | [[fallthrough]]; | ||
| 16203 | case 0: | ||
| 16204 |
4/4✓ Branch 0 taken 569 times.
✓ Branch 1 taken 9768 times.
✓ Branch 2 taken 428 times.
✓ Branch 3 taken 141 times.
|
10337 | if(++clk2>72 && !(zc_oldrand()&3)) |
| 16205 | { | ||
| 16206 | 141 | addEwpn(x,y,z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 16207 | 141 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 16208 | 141 | clk2=0; | |
| 16209 | 141 | } | |
| 16210 | |||
| 16211 | 10337 | Stunclk=0; | |
| 16212 | 10337 | constant_walk(rate,homing,spw_none); | |
| 16213 | 10337 | break; | |
| 16214 | |||
| 16215 | case 1: | ||
| 16216 | case 2: | ||
| 16217 |
2/2✓ Branch 0 taken 2512 times.
✓ Branch 1 taken 31 times.
|
2543 | if(--Stunclk<=0) |
| 16218 | { | ||
| 16219 | 31 | int32_t r=zc_oldrand(); | |
| 16220 | |||
| 16221 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 13 times.
|
31 | if(r&1) |
| 16222 | { | ||
| 16223 | 13 | y=96; | |
| 16224 | |||
| 16225 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 8 times.
|
13 | if(r&2) |
| 16226 | 5 | x=160; | |
| 16227 | else | ||
| 16228 | 8 | x=48; | |
| 16229 | |||
| 16230 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 5 times.
|
13 | if(tooclose(x,y,48)) |
| 16231 | 5 | x=208-x; | |
| 16232 | 13 | } | |
| 16233 | |||
| 16234 | 31 | loadpalset(csBOSS,pSprite(d->bosspal)); | |
| 16235 | 31 | misc=0; | |
| 16236 | 31 | } | |
| 16237 | |||
| 16238 | 2543 | break; | |
| 16239 | |||
| 16240 | case 3: | ||
| 16241 | { | ||
| 16242 |
2/2✓ Branch 0 taken 648 times.
✓ Branch 1 taken 8 times.
|
656 | if(hclk>0) |
| 16243 | 648 | break; | |
| 16244 | |||
| 16245 | 8 | misc=4; | |
| 16246 | 8 | clk=0; | |
| 16247 | 8 | hxofs=1000; | |
| 16248 | 8 | loadpalset(9,pSprite(spPILE)); | |
| 16249 | 8 | music_stop(); | |
| 16250 | 8 | stop_sfx(WAV_ROAR); | |
| 16251 | |||
| 16252 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(deadsfx>0) sfx(deadsfx,pan(int32_t(x))); |
| 16253 | |||
| 16254 | 8 | sfx(WAV_GANON); | |
| 16255 | //Ganon's dustpile; fall in sideview. -Z | ||
| 16256 | //item *dustpile = new item(x+8,y+8,(zfix)0,iPile,ipDUMMY,0); | ||
| 16257 | //dustpile->miscellaneous[31] = eeGANON; | ||
| 16258 |
6/12✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
|
8 | items.add(new item(x+8,y+8,(zfix)0,iPile,ipDUMMY,0)); |
| 16259 | 8 | item *dustpile = NULL; | |
| 16260 | //dustpile = (item *)items.spr(items.Count() - 1)->getUID(); | ||
| 16261 | 8 | dustpile = (item *)items.spr(items.Count() - 1); | |
| 16262 | 8 | dustpile->linked_parent = eeGANON; //was miscellaneous[31] | |
| 16263 | //setmapflag(); //Could be why the Triforce doesn't drop. Disabling this now. -Z ( 6th March, 2019 ) | ||
| 16264 | //items.add(new item(x+8,y+8,(zfix)0,iPile,ipDUMMY,0)); | ||
| 16265 | 8 | break; | |
| 16266 | } | ||
| 16267 | |||
| 16268 | case 4: | ||
| 16269 |
2/2✓ Branch 0 taken 632 times.
✓ Branch 1 taken 8 times.
|
640 | if(clk>=80) |
| 16270 | { | ||
| 16271 | 8 | misc=5; | |
| 16272 | |||
| 16273 | //game->lvlitems[dlevel]|=liBOSS; | ||
| 16274 | |||
| 16275 | 8 | sfx(WAV_CLEARED); | |
| 16276 | //Add the big TF over the ashes! | ||
| 16277 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
|
24 | for(word q = 0; q < items.Count(); q++) |
| 16278 | { | ||
| 16279 | 16 | item *ashes = (item*)items.spr(q); | |
| 16280 |
3/4✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 8 times.
|
16 | if ( ashes->linked_parent == eeGANON && (ashes->pickup&ipDUMMY)) |
| 16281 | { | ||
| 16282 | //Z_scripterrlog("Found correct dustpile!\n"); | ||
| 16283 |
4/8✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
|
8 | items.add(new item(ashes->x,ashes->y,(zfix)0,iBigTri,ipBIGTRI,0)); |
| 16284 | 8 | item *bigtriforce = NULL; | |
| 16285 | 8 | bigtriforce = (item *)items.spr(items.Count() - 1); | |
| 16286 | 8 | bigtriforce->linked_parent = eeGANON; | |
| 16287 | 8 | } | |
| 16288 | 16 | } | |
| 16289 | //setmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); | ||
| 16290 | //game->lvlitems[dlevel]|=liBOSS; // if we had more rule bits, we could mark him dead so that he does not respawn. -Z | ||
| 16291 | 8 | } | |
| 16292 | |||
| 16293 | 640 | break; | |
| 16294 | 6 | case 5: return true; | |
| 16295 | } | ||
| 16296 | |||
| 16297 | 14176 | return enemy::animate(index); | |
| 16298 | 14182 | } | |
| 16299 | |||
| 16300 | |||
| 16301 | 679 | int32_t eGanon::takehit(weapon *w, weapon* realweap) | |
| 16302 | { | ||
| 16303 | //these are here to bypass compiler warnings about unused arguments | ||
| 16304 | 679 | int32_t wpnId = w->id; | |
| 16305 | 679 | int32_t power = w->power; | |
| 16306 | 679 | int32_t enemyHitWeapon = w->parentitem; | |
| 16307 | |||
| 16308 |
3/3✓ Branch 0 taken 529 times.
✓ Branch 1 taken 62 times.
✓ Branch 2 taken 88 times.
|
679 | switch(misc) |
| 16309 | { | ||
| 16310 | case 0: | ||
| 16311 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 39 times.
|
62 | if(wpnId!=wSword) |
| 16312 | 23 | return 0; | |
| 16313 | |||
| 16314 | 39 | hp-=power; | |
| 16315 | |||
| 16316 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 8 times.
|
39 | if(hp>0) |
| 16317 | { | ||
| 16318 | 31 | misc=1; | |
| 16319 | 31 | Stunclk=64; | |
| 16320 | 31 | } | |
| 16321 | else | ||
| 16322 | { | ||
| 16323 | 8 | loadpalset(csBOSS,pSprite(spBROWN)); | |
| 16324 | 8 | misc=2; | |
| 16325 | 8 | Stunclk=284; | |
| 16326 | 8 | hp=guysbuf[id&0xFFF].hp; //16*game->get_hero_dmgmult(); | |
| 16327 | } | ||
| 16328 | |||
| 16329 | 39 | sfx(WAV_EHIT,pan(int32_t(x))); | |
| 16330 | |||
| 16331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
|
39 | if(hitsfx>0) sfx(hitsfx,pan(int32_t(x))); |
| 16332 | |||
| 16333 | 39 | return 1; | |
| 16334 | |||
| 16335 | case 2: | ||
| 16336 |
4/6✓ Branch 0 taken 80 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
88 | if(wpnId!=wArrow || (enemyHitWeapon>-1 ? itemsbuf[enemyHitWeapon].power : current_item_power(itype_arrow))<4) |
| 16337 | 80 | return 0; | |
| 16338 | |||
| 16339 | 8 | misc=3; | |
| 16340 | 8 | hclk=81; | |
| 16341 | 8 | loadpalset(9,pSprite(spBROWN)); | |
| 16342 | 8 | return 1; | |
| 16343 | } | ||
| 16344 | |||
| 16345 | 529 | return 0; | |
| 16346 | 679 | } | |
| 16347 | |||
| 16348 | 15928 | void eGanon::draw(BITMAP *dest) | |
| 16349 | { | ||
| 16350 |
6/6✓ Branch 0 taken 2640 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 559 times.
✓ Branch 3 taken 1755 times.
✓ Branch 4 taken 10328 times.
✓ Branch 5 taken 640 times.
|
15928 | switch(misc) |
| 16351 | { | ||
| 16352 | case 0: | ||
| 16353 |
2/2✓ Branch 0 taken 7747 times.
✓ Branch 1 taken 2581 times.
|
10328 | if((clk&3)==3) |
| 16354 | 2581 | tile=(zc_oldrand()%5)*2+o_tile; | |
| 16355 | |||
| 16356 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 10328 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
10328 | if ( (editorflags & ENEMY_FLAG1) && current_item_power(itype_amulet) >= 2 ) //ganon is visible to level 2 amulet |
| 16357 | { | ||
| 16358 | |||
| 16359 | ✗ | if ( editorflags & ENEMY_FLAG16 ) //draw cloaked | |
| 16360 | { | ||
| 16361 | ✗ | int odraw = drawstyle; | |
| 16362 | ✗ | drawstyle = 2; | |
| 16363 | ✗ | drawblock(dest,15); | |
| 16364 | ✗ | drawstyle = odraw; | |
| 16365 | ✗ | } | |
| 16366 | else | ||
| 16367 | { | ||
| 16368 | ✗ | drawblock(dest,15); | |
| 16369 | } | ||
| 16370 | ✗ | break; | |
| 16371 | |||
| 16372 | } | ||
| 16373 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 10328 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
10328 | else if ( (editorflags & ENEMY_FLAG2) && (game->item[dmisc13]) ) |
| 16374 | { | ||
| 16375 | ✗ | if ( editorflags & ENEMY_FLAG16 ) //draw cloaked | |
| 16376 | { | ||
| 16377 | ✗ | int odraw = drawstyle; | |
| 16378 | ✗ | drawstyle = 2; | |
| 16379 | ✗ | drawblock(dest,15); | |
| 16380 | ✗ | drawstyle = odraw; | |
| 16381 | ✗ | } | |
| 16382 | else | ||
| 16383 | { | ||
| 16384 | ✗ | drawblock(dest,15); | |
| 16385 | } | ||
| 16386 | ✗ | break; | |
| 16387 | } | ||
| 16388 |
1/2✓ Branch 0 taken 10328 times.
✗ Branch 1 not taken.
|
10328 | if(db!=999) |
| 16389 | 10328 | break; | |
| 16390 | [[fallthrough]]; | ||
| 16391 | case 2: | ||
| 16392 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
559 | if(Stunclk<64 && (Stunclk&1)) |
| 16393 | ✗ | break; | |
| 16394 | [[fallthrough]]; | ||
| 16395 | case -1: | ||
| 16396 | 2314 | tile=o_tile; | |
| 16397 | |||
| 16398 | [[fallthrough]]; | ||
| 16399 | case 1: | ||
| 16400 | case 3: | ||
| 16401 | 4954 | drawblock(dest,15); | |
| 16402 | 4954 | break; | |
| 16403 | |||
| 16404 | case 4: | ||
| 16405 | 640 | draw_guts(dest); | |
| 16406 | 640 | draw_flash(dest); | |
| 16407 | 640 | break; | |
| 16408 | } | ||
| 16409 | 15928 | } | |
| 16410 | |||
| 16411 | 640 | void eGanon::draw_guts(BITMAP *dest) | |
| 16412 | { | ||
| 16413 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 136 times.
|
640 | int32_t c = zc_min(clk>>3,8); |
| 16414 | 640 | tile = clk<24 ? 74 : 75; | |
| 16415 | 640 | overtile16(dest,tile,x+8,y+c+playing_field_offset,9,0); | |
| 16416 | 640 | overtile16(dest,tile,x+8,y+16-c+playing_field_offset,9,0); | |
| 16417 | 640 | overtile16(dest,tile,x+c,y+8+playing_field_offset,9,0); | |
| 16418 | 640 | overtile16(dest,tile,x+16-c,y+8+playing_field_offset,9,0); | |
| 16419 | 640 | overtile16(dest,tile,x+c,y+c+playing_field_offset,9,0); | |
| 16420 | 640 | overtile16(dest,tile,x+16-c,y+c+playing_field_offset,9,0); | |
| 16421 | 640 | overtile16(dest,tile,x+c,y+16-c+playing_field_offset,9,0); | |
| 16422 | 640 | overtile16(dest,tile,x+16-c,y+16-c+playing_field_offset,9,0); | |
| 16423 | 640 | } | |
| 16424 | |||
| 16425 | 640 | void eGanon::draw_flash(BITMAP *dest) | |
| 16426 | { | ||
| 16427 | |||
| 16428 | 640 | int32_t c = clk-(clk>>2); | |
| 16429 | 640 | cs = (frame&3)+6; | |
| 16430 | 640 | overtile16(dest,194,x+8,y+8-clk+playing_field_offset,cs,0); | |
| 16431 | 640 | overtile16(dest,194,x+8,y+8+clk+playing_field_offset,cs,2); | |
| 16432 | 640 | overtile16(dest,195,x+8-clk,y+8+playing_field_offset,cs,0); | |
| 16433 | 640 | overtile16(dest,195,x+8+clk,y+8+playing_field_offset,cs,1); | |
| 16434 | 640 | overtile16(dest,196,x+8-c,y+8-c+playing_field_offset,cs,0); | |
| 16435 | 640 | overtile16(dest,196,x+8+c,y+8-c+playing_field_offset,cs,1); | |
| 16436 | 640 | overtile16(dest,196,x+8-c,y+8+c+playing_field_offset,cs,2); | |
| 16437 | 640 | overtile16(dest,196,x+8+c,y+8+c+playing_field_offset,cs,3); | |
| 16438 | 640 | } | |
| 16439 | |||
| 16440 | 7 | void getBigTri(int32_t id2) | |
| 16441 | { | ||
| 16442 | /* | ||
| 16443 | ************************* | ||
| 16444 | * BIG TRIFORCE SEQUENCE * | ||
| 16445 | ************************* | ||
| 16446 | 0 BIGTRI out, WHITE flash in | ||
| 16447 | 4 WHITE flash out, PILE cset white | ||
| 16448 | 8 WHITE in | ||
| 16449 | ... | ||
| 16450 | 188 WHITE out | ||
| 16451 | 191 PILE cset red | ||
| 16452 | 200 top SHUTTER opens | ||
| 16453 | 209 bottom SHUTTER opens | ||
| 16454 | */ | ||
| 16455 | 7 | sfx(itemsbuf[id2].playsound); | |
| 16456 | 7 | guys.clear(); | |
| 16457 | |||
| 16458 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(itemsbuf[id2].flags & ITEM_GAMEDATA) |
| 16459 | { | ||
| 16460 | ✗ | game->lvlitems[dlevel]|=liTRIFORCE; | |
| 16461 | ✗ | } | |
| 16462 | |||
| 16463 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | setmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 16464 | |||
| 16465 | 7 | draw_screen(tmpscr); | |
| 16466 | |||
| 16467 |
4/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1344 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 1344 times.
|
1351 | for(int32_t f=0; f<24*8 && !Quit; f++) |
| 16468 | { | ||
| 16469 |
2/2✓ Branch 0 taken 1337 times.
✓ Branch 1 taken 7 times.
|
1344 | if(f==4) |
| 16470 | { | ||
| 16471 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 7 times.
|
112 | for(int32_t i=1; i<16; i++) |
| 16472 | { | ||
| 16473 | 105 | RAMpal[CSET(9)+i]=_RGB(63,63,63); | |
| 16474 | 105 | } | |
| 16475 | 7 | } | |
| 16476 | |||
| 16477 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 168 times.
|
1344 | if((f&7)==0) |
| 16478 | { | ||
| 16479 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 168 times.
|
672 | for(int32_t cs=2; cs<5; cs++) |
| 16480 | { | ||
| 16481 |
2/2✓ Branch 0 taken 7560 times.
✓ Branch 1 taken 504 times.
|
8064 | for(int32_t i=1; i<16; i++) |
| 16482 | { | ||
| 16483 | 7560 | RAMpal[CSET(cs)+i]=_RGB(63,63,63); | |
| 16484 | 7560 | } | |
| 16485 | 504 | } | |
| 16486 | |||
| 16487 | 168 | refreshpal=true; | |
| 16488 | 168 | } | |
| 16489 | |||
| 16490 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 168 times.
|
1344 | if((f&7)==4) |
| 16491 | { | ||
| 16492 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | if(currscr<128) loadlvlpal(DMaps[currdmap].color); |
| 16493 | ✗ | else loadlvlpal(0xB); | |
| 16494 | 168 | } | |
| 16495 | |||
| 16496 |
2/2✓ Branch 0 taken 1337 times.
✓ Branch 1 taken 7 times.
|
1344 | if(f==191) |
| 16497 | { | ||
| 16498 | 7 | loadpalset(9,pSprite(spPILE)); | |
| 16499 | 7 | } | |
| 16500 | |||
| 16501 | 1344 | advanceframe(true); | |
| 16502 | 1344 | } | |
| 16503 | |||
| 16504 | //play_DmapMusic(); | ||
| 16505 | 7 | playLevelMusic(); | |
| 16506 | |||
| 16507 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7 | if(itemsbuf[id2].flags & ITEM_FLAG1 && currscr < 128) |
| 16508 | { | ||
| 16509 | ✗ | Hero.dowarp(1,0); //side warp | |
| 16510 | ✗ | } | |
| 16511 | 7 | } | |
| 16512 | |||
| 16513 | /**********************************/ | ||
| 16514 | /*** Multiple-Segment Enemies ***/ | ||
| 16515 | /**********************************/ | ||
| 16516 | |||
| 16517 | |||
| 16518 | //! No. I am not adding SIZEflags to Moldorm and Lanmola. -Z 12 Aug 2020 | ||
| 16519 | 170 | eMoldorm::eMoldorm(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 16520 | 170 | { | |
| 16521 |
1/2✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
|
85 | if( !(editorflags & ENEMY_FLAG5) ) |
| 16522 | { | ||
| 16523 |
1/2✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
|
85 | x=128; |
| 16524 |
1/2✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
|
85 | y=48; |
| 16525 | 85 | } | |
| 16526 | //else { x = X; y = Y; } | ||
| 16527 |
1/2✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
|
85 | dir=(zc_oldrand()&7)+8; |
| 16528 | 85 | superman=1; | |
| 16529 | 85 | fading=fade_invisible; | |
| 16530 | 85 | hxofs=1000; | |
| 16531 | 85 | segcnt=clk; | |
| 16532 | 85 | segid=Id|0x1000; | |
| 16533 | 85 | clk=0; | |
| 16534 |
1/2✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
|
85 | id=guys.Count(); |
| 16535 |
3/6✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 85 times.
✓ Branch 4 taken 85 times.
✗ Branch 5 not taken.
|
85 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 16536 | 85 | tile=o_tile; | |
| 16537 | 85 | hitdir = -1; | |
| 16538 | 85 | stickclk = 0; | |
| 16539 | |||
| 16540 | /* | ||
| 16541 | if (get_bit(quest_rules,qr_NEWENEMYTILES)) | ||
| 16542 | { | ||
| 16543 | tile=nets+1220; | ||
| 16544 | } | ||
| 16545 | else | ||
| 16546 | { | ||
| 16547 | tile=57; | ||
| 16548 | } | ||
| 16549 | */ | ||
| 16550 | 85 | } | |
| 16551 | |||
| 16552 | 79409 | bool eMoldorm::animate(int32_t index) | |
| 16553 | { | ||
| 16554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 79409 times.
|
79409 | if(switch_hooked) return enemy::animate(index); |
| 16555 | 79409 | int32_t max_y = isdungeon() ? 100 : 100+28; //warning: Ugly hack. -Z | |
| 16556 |
2/2✓ Branch 0 taken 61065 times.
✓ Branch 1 taken 18344 times.
|
79409 | if ( y > (max_y) ) |
| 16557 | { | ||
| 16558 | 18344 | ++stickclk; //Keep Moldorm from pacinn the bottom row or leaving the screen via the bottom edge. -Z 8th Sept, 2019 | |
| 16559 | //Z_scripterrlog("Stickclk is %d\n", stickclk); | ||
| 16560 | 18344 | } | |
| 16561 |
2/2✓ Branch 0 taken 79034 times.
✓ Branch 1 taken 375 times.
|
79409 | if ( stickclk > 45 ) |
| 16562 | { | ||
| 16563 | 375 | stickclk = 0; | |
| 16564 | 375 | newdir_8_old(rate,homing,spw_floater); //chage dir to keep from getting stuck. | |
| 16565 | 375 | } | |
| 16566 | |||
| 16567 | |||
| 16568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 79409 times.
|
79409 | if(clk==0) |
| 16569 | { | ||
| 16570 | 79409 | removearmos(x,y,ffcactivated); | |
| 16571 | 79409 | } | |
| 16572 | |||
| 16573 |
2/2✓ Branch 0 taken 1083 times.
✓ Branch 1 taken 78326 times.
|
79409 | if(clk2) |
| 16574 | { | ||
| 16575 |
2/2✓ Branch 0 taken 1026 times.
✓ Branch 1 taken 57 times.
|
1083 | if(--clk2 == 0) |
| 16576 | { | ||
| 16577 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(flags&guy_neverret) |
| 16578 | 57 | never_return(index); | |
| 16579 | |||
| 16580 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
57 | if(!dmisc2 || (editorflags & ENEMY_FLAG6)) |
| 16581 | 57 | leave_item(); | |
| 16582 | |||
| 16583 | 57 | stop_bgsfx(index); | |
| 16584 | 57 | return true; | |
| 16585 | } | ||
| 16586 | 1026 | } | |
| 16587 | else | ||
| 16588 | { | ||
| 16589 |
1/2✓ Branch 0 taken 78326 times.
✗ Branch 1 not taken.
|
78326 | if(stunclk>0) |
| 16590 | ✗ | stunclk=0; | |
| 16591 | 78326 | constant_walk_8_old(rate,homing,spw_floater); | |
| 16592 | |||
| 16593 | |||
| 16594 | 78326 | misc=dir; | |
| 16595 | |||
| 16596 | // If any higher-numbered segments were killed, segcnt can be too high, | ||
| 16597 | // leading to a crash | ||
| 16598 |
1/2✓ Branch 0 taken 78326 times.
✗ Branch 1 not taken.
|
78326 | if(index+segcnt>=guys.Count()) |
| 16599 | ✗ | segcnt=guys.Count()-index-1; | |
| 16600 | |||
| 16601 |
2/2✓ Branch 0 taken 78326 times.
✓ Branch 1 taken 429954 times.
|
508280 | for(int32_t i=index+1; i<index+segcnt+1; i++) |
| 16602 | { | ||
| 16603 | 429954 | enemy* segment=((enemy*)guys.spr(i)); | |
| 16604 | |||
| 16605 | // More validation - if segcnt was wrong, this may not | ||
| 16606 | // actually be a Moldorm segment | ||
| 16607 |
1/2✓ Branch 0 taken 429954 times.
✗ Branch 1 not taken.
|
429954 | if(segment->id!=segid) |
| 16608 | { | ||
| 16609 | ✗ | segcnt=i-index-1; | |
| 16610 | ✗ | break; | |
| 16611 | } | ||
| 16612 | |||
| 16613 |
2/2✓ Branch 0 taken 351548 times.
✓ Branch 1 taken 78406 times.
|
429954 | if(i==index+1) |
| 16614 | { | ||
| 16615 | 78406 | x=segment->x; | |
| 16616 | 78406 | y=segment->y; | |
| 16617 | 78406 | } | |
| 16618 | |||
| 16619 | 429954 | segment->o_tile=tile; //I refuse to fuck with adding scripttile to segmented enemies. -Z | |
| 16620 | //Script your own blasted segmented bosses!! -Z | ||
| 16621 | 429954 | segment->parent_script_UID = this->script_UID; | |
| 16622 |
4/4✓ Branch 0 taken 78326 times.
✓ Branch 1 taken 351628 times.
✓ Branch 2 taken 11070 times.
✓ Branch 3 taken 67256 times.
|
429954 | if((i==index+segcnt)&&(i!=index+1)) //tail |
| 16623 | { | ||
| 16624 | 67256 | segment->dummy_int[1]=2; | |
| 16625 | 67256 | } | |
| 16626 | else | ||
| 16627 | { | ||
| 16628 | 362698 | segment->dummy_int[1]=1; | |
| 16629 | } | ||
| 16630 | |||
| 16631 |
2/2✓ Branch 0 taken 351548 times.
✓ Branch 1 taken 78406 times.
|
429954 | if(i==index+1) //head |
| 16632 | { | ||
| 16633 | 78406 | segment->dummy_int[1]=0; | |
| 16634 | 78406 | } | |
| 16635 | |||
| 16636 |
2/2✓ Branch 0 taken 429599 times.
✓ Branch 1 taken 355 times.
|
429954 | if(segment->hp <= 0) |
| 16637 | { | ||
| 16638 | 355 | int32_t offset=1; | |
| 16639 | |||
| 16640 |
2/2✓ Branch 0 taken 355 times.
✓ Branch 1 taken 577 times.
|
932 | for(int32_t j=i; j<index+segcnt; j++) |
| 16641 | { | ||
| 16642 | // Triple-check | ||
| 16643 |
1/2✓ Branch 0 taken 577 times.
✗ Branch 1 not taken.
|
577 | if(((enemy*)guys.spr(j+1))->id!=segid) |
| 16644 | { | ||
| 16645 | ✗ | segcnt=j-index+1; // Add 1 because of --segcnt below | |
| 16646 | ✗ | break; | |
| 16647 | } | ||
| 16648 | 577 | zc_swap(((enemy*)guys.spr(j))->hp,((enemy*)guys.spr(j+1))->hp); | |
| 16649 | 577 | zc_swap(((enemy*)guys.spr(j))->hclk,((enemy*)guys.spr(j+1))->hclk); | |
| 16650 | 577 | } | |
| 16651 | |||
| 16652 | 355 | segment->hclk=33; | |
| 16653 | 355 | --segcnt; | |
| 16654 | 355 | --i; // Recheck the same index in case multiple segments died at once | |
| 16655 | 355 | } | |
| 16656 | 429954 | } | |
| 16657 | |||
| 16658 |
2/2✓ Branch 0 taken 78269 times.
✓ Branch 1 taken 57 times.
|
78326 | if(segcnt==0) |
| 16659 | { | ||
| 16660 | 57 | clk2=19; | |
| 16661 | |||
| 16662 | 57 | x=guys.spr(index+1)->x; | |
| 16663 | 57 | y=guys.spr(index+1)->y; | |
| 16664 | 57 | } | |
| 16665 | } | ||
| 16666 | |||
| 16667 | 79352 | return false; | |
| 16668 | 79409 | } | |
| 16669 | |||
| 16670 | 970 | esMoldorm::esMoldorm(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 16671 | 970 | { | |
| 16672 |
1/2✓ Branch 0 taken 485 times.
✗ Branch 1 not taken.
|
485 | if( !(editorflags & ENEMY_FLAG5) ) |
| 16673 | { | ||
| 16674 |
1/2✓ Branch 0 taken 485 times.
✗ Branch 1 not taken.
|
485 | x=128; |
| 16675 |
1/2✓ Branch 0 taken 485 times.
✗ Branch 1 not taken.
|
485 | y=48; |
| 16676 | 485 | } | |
| 16677 | |||
| 16678 |
3/6✓ Branch 0 taken 485 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 485 times.
✓ Branch 4 taken 485 times.
✗ Branch 5 not taken.
|
485 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 16679 | 485 | hyofs=4; | |
| 16680 | 485 | hxsz=hysz=8; | |
| 16681 | 485 | hxofs=1000; | |
| 16682 | 485 | mainguy=count_enemy=false; | |
| 16683 | 485 | parentclk = 0; | |
| 16684 | 485 | bgsfx=-1; | |
| 16685 | 485 | flags&=~guy_neverret; | |
| 16686 | //deadsfx = WAV_EDEAD; | ||
| 16687 | 485 | isCore = false; | |
| 16688 | 485 | } | |
| 16689 | |||
| 16690 | 436344 | bool esMoldorm::animate(int32_t index) | |
| 16691 | { | ||
| 16692 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 436344 times.
|
436344 | if(switch_hooked) return enemy::animate(index); |
| 16693 | // Shouldn't be possible, but better to be sure | ||
| 16694 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 436344 times.
|
436344 | if(index==0) |
| 16695 | ✗ | dying=true; | |
| 16696 | |||
| 16697 |
2/2✓ Branch 0 taken 6390 times.
✓ Branch 1 taken 429954 times.
|
436344 | if(dying) |
| 16698 | { | ||
| 16699 |
1/2✓ Branch 0 taken 6390 times.
✗ Branch 1 not taken.
|
6390 | if(!dmisc2) |
| 16700 | 6390 | item_set=0; | |
| 16701 | |||
| 16702 | 6390 | return Dead(index); | |
| 16703 | } | ||
| 16704 | |||
| 16705 |
2/2✓ Branch 0 taken 20598 times.
✓ Branch 1 taken 409356 times.
|
429954 | if(clk>=0) |
| 16706 | { | ||
| 16707 | 409356 | hxofs=4; | |
| 16708 | 409356 | step=((enemy*)guys.spr(index-1))->step; | |
| 16709 | |||
| 16710 |
2/2✓ Branch 0 taken 31229 times.
✓ Branch 1 taken 378127 times.
|
409356 | if(parentclk == 0) |
| 16711 | { | ||
| 16712 | 31229 | misc=dir; | |
| 16713 | 31229 | dir=((enemy*)guys.spr(index-1))->misc; | |
| 16714 | //do alignment, as in parent's animation :-/ -DD | ||
| 16715 | 31229 | x.doFloor(); | |
| 16716 | 31229 | y.doFloor(); | |
| 16717 | 31229 | } | |
| 16718 | |||
| 16719 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 409356 times.
|
409356 | if(step) |
| 16720 | 409356 | parentclk=(parentclk+1)%((int32_t)(8.0/step)); | |
| 16721 | |||
| 16722 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 409356 times.
|
409356 | if(!watch) |
| 16723 | { | ||
| 16724 | 409356 | sprite::move(step); | |
| 16725 | 409356 | } | |
| 16726 | 409356 | } | |
| 16727 | |||
| 16728 | 429954 | return enemy::animate(index); | |
| 16729 | 436344 | } | |
| 16730 | |||
| 16731 | 1645 | int32_t esMoldorm::takehit(weapon *w, weapon* realweap) | |
| 16732 | { | ||
| 16733 |
2/2✓ Branch 0 taken 1498 times.
✓ Branch 1 taken 147 times.
|
1645 | if(enemy::takehit(w,realweap)) |
| 16734 | 1498 | return (w->id==wSBomb) ? 1 : 2; // force it to wait a frame before checking sword attacks again | |
| 16735 | |||
| 16736 | 147 | return 0; | |
| 16737 | 1645 | } | |
| 16738 | |||
| 16739 | 438294 | void esMoldorm::draw(BITMAP *dest) | |
| 16740 | { | ||
| 16741 | 438294 | tile=o_tile; | |
| 16742 | 438294 | int32_t fdiv = frate/4; | |
| 16743 |
1/2✓ Branch 0 taken 438294 times.
✗ Branch 1 not taken.
|
438294 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 16744 | |||
| 16745 |
2/2✓ Branch 0 taken 361156 times.
✓ Branch 1 taken 77138 times.
|
438294 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 16746 | 438294 | efrate:((clk>=(frate>>1))?1:0); | |
| 16747 | |||
| 16748 |
2/2✓ Branch 0 taken 77138 times.
✓ Branch 1 taken 361156 times.
|
438294 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 16749 | { | ||
| 16750 | 361156 | tile+=dummy_int[1]*40; | |
| 16751 | |||
| 16752 |
2/2✓ Branch 0 taken 16310 times.
✓ Branch 1 taken 344846 times.
|
361156 | if(dir<8) |
| 16753 | { | ||
| 16754 | 16310 | flip=0; | |
| 16755 |
2/2✓ Branch 0 taken 12412 times.
✓ Branch 1 taken 3898 times.
|
16310 | tile+=4*zc_max(dir, 0); // dir is -1 if trapped |
| 16756 | |||
| 16757 |
1/2✓ Branch 0 taken 16310 times.
✗ Branch 1 not taken.
|
16310 | if(dir>3) // Skip to the next row for diagonals |
| 16758 | ✗ | tile+=4; | |
| 16759 | 16310 | } | |
| 16760 | else | ||
| 16761 | { | ||
| 16762 |
8/9✓ Branch 0 taken 37639 times.
✓ Branch 1 taken 47584 times.
✓ Branch 2 taken 38450 times.
✓ Branch 3 taken 47147 times.
✓ Branch 4 taken 39397 times.
✓ Branch 5 taken 38189 times.
✓ Branch 6 taken 46292 times.
✓ Branch 7 taken 50148 times.
✗ Branch 8 not taken.
|
344846 | switch(dir-8) //directions get screwed up after 8. *shrug* |
| 16763 | { | ||
| 16764 | case up: //u | ||
| 16765 | 37639 | flip=0; | |
| 16766 | 37639 | break; | |
| 16767 | |||
| 16768 | case l_up: //d | ||
| 16769 | 47584 | flip=0; | |
| 16770 | 47584 | tile+=4; | |
| 16771 | 47584 | break; | |
| 16772 | |||
| 16773 | case l_down: //l | ||
| 16774 | 38450 | flip=0; | |
| 16775 | 38450 | tile+=8; | |
| 16776 | 38450 | break; | |
| 16777 | |||
| 16778 | case left: //r | ||
| 16779 | 47147 | flip=0; | |
| 16780 | 47147 | tile+=12; | |
| 16781 | 47147 | break; | |
| 16782 | |||
| 16783 | case r_down: //ul | ||
| 16784 | 39397 | flip=0; | |
| 16785 | 39397 | tile+=20; | |
| 16786 | 39397 | break; | |
| 16787 | |||
| 16788 | case down: //ur | ||
| 16789 | 38189 | flip=0; | |
| 16790 | 38189 | tile+=24; | |
| 16791 | 38189 | break; | |
| 16792 | |||
| 16793 | case r_up: //dl | ||
| 16794 | 46292 | flip=0; | |
| 16795 | 46292 | tile+=28; | |
| 16796 | 46292 | break; | |
| 16797 | |||
| 16798 | case right: //dr | ||
| 16799 | 50148 | flip=0; | |
| 16800 | 50148 | tile+=32; | |
| 16801 | 50148 | break; | |
| 16802 | } | ||
| 16803 | } | ||
| 16804 | |||
| 16805 | 361156 | tile+=f2; | |
| 16806 | 361156 | } | |
| 16807 | |||
| 16808 |
2/2✓ Branch 0 taken 20652 times.
✓ Branch 1 taken 417642 times.
|
438294 | if(clk>=0) |
| 16809 | 417642 | enemy::draw(dest); | |
| 16810 | 438294 | } | |
| 16811 | |||
| 16812 | 478 | eLanmola::eLanmola(zfix X,zfix Y,int32_t Id,int32_t Clk) : eBaseLanmola(X,Y,Id,Clk) | |
| 16813 | 478 | { | |
| 16814 |
1/2✓ Branch 0 taken 239 times.
✗ Branch 1 not taken.
|
239 | if( !(editorflags & ENEMY_FLAG5) ) |
| 16815 | { | ||
| 16816 |
1/2✓ Branch 0 taken 239 times.
✗ Branch 1 not taken.
|
239 | x=64; |
| 16817 |
1/2✓ Branch 0 taken 239 times.
✗ Branch 1 not taken.
|
239 | y=80; |
| 16818 | 239 | } | |
| 16819 | //else { x = X; y = Y; } | ||
| 16820 | //zprint2("lanmola index is %d\n", index); | ||
| 16821 | //byte legaldirs = 0; | ||
| 16822 | 239 | int32_t incr = 16; | |
| 16823 | //int32_t possiiblepos = 0; | ||
| 16824 | //int32_t positions[8] = {0}; | ||
| 16825 | |||
| 16826 | //Don't spawn in pits. | ||
| 16827 |
5/8✓ Branch 0 taken 239 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 239 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 239 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 149 times.
✓ Branch 7 taken 90 times.
|
239 | if ( m_walkflag_simple(x, y) ) |
| 16828 | { | ||
| 16829 | //zprint2("Can't spawn here.\n"); | ||
| 16830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 124 times.
|
124 | for ( ; incr < 240; incr += 16 ) |
| 16831 | { | ||
| 16832 | //move if we spawn over a pit | ||
| 16833 | //check each direction | ||
| 16834 |
7/12✓ Branch 0 taken 124 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 124 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 124 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 124 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 124 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 120 times.
|
124 | if ( !m_walkflag_simple(x-incr, y) ) //legaldirs |= 0x1; //left |
| 16835 | { | ||
| 16836 | //zprint2("Spawn adjustment: -x (%d)\n", incr); | ||
| 16837 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | x-=incr; break; |
| 16838 | } | ||
| 16839 |
7/12✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 120 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 120 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 120 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 120 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 28 times.
✓ Branch 11 taken 92 times.
|
120 | else if ( !m_walkflag_simple(x+incr, y) ) //legaldirs |= 0x2; //right |
| 16840 | { | ||
| 16841 | //zprint2("Spawn adjustment: +x (%d)\n", incr); | ||
| 16842 |
1/2✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
|
28 | x+=incr; break; |
| 16843 | } | ||
| 16844 |
9/16✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 92 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 92 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 92 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 92 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 92 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 32 times.
✓ Branch 15 taken 60 times.
|
92 | else if ( !m_walkflag_simple(x-incr, y-incr) ) //legaldirs |= 0x4; //left-up |
| 16845 | { | ||
| 16846 | //zprint2("Spawn adjustment: -x (%d), -y (%d)\n", incr, incr); | ||
| 16847 |
2/4✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
|
32 | x-=incr; y-=incr; break; |
| 16848 | } | ||
| 16849 |
8/16✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 60 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 60 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 60 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 60 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 60 times.
|
60 | else if ( !m_walkflag_simple(x+incr, y-incr) ) //legaldirs |= 0x8; //right-up |
| 16850 | { | ||
| 16851 | //zprint2("Spawn adjustment: +x (%d), -y (%d)\n", incr, incr); | ||
| 16852 | ✗ | x+=incr; y-=incr; break; | |
| 16853 | } | ||
| 16854 |
6/12✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 60 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 60 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 60 times.
|
60 | else if ( !m_walkflag_simple(x, y-incr) ) // legaldirs |= 0x10; //up |
| 16855 | { | ||
| 16856 | //zprint2("Spawn adjustment: -y (%d)\n", incr); | ||
| 16857 | ✗ | y -= incr; break; | |
| 16858 | } | ||
| 16859 |
6/12✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 60 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 60 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 60 times.
|
60 | else if ( !m_walkflag_simple(x, y+incr) ) //legaldirs |= 0x20; //down |
| 16860 | { | ||
| 16861 | //zprint2("Spawn adjustment: +y (%d)\n", incr); | ||
| 16862 | ✗ | y+=incr; break; | |
| 16863 | } | ||
| 16864 |
9/16✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 60 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 60 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 60 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 60 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 26 times.
✓ Branch 15 taken 34 times.
|
60 | else if ( !m_walkflag_simple(x-incr, y+incr) ) //legaldirs |= 0x40; //left-down |
| 16865 | { | ||
| 16866 | //zprint2("Spawn adjustment: -x (%d), +y (%d)\n", incr, incr); | ||
| 16867 |
2/4✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
|
26 | x-=incr; y+=incr; break; |
| 16868 | } | ||
| 16869 |
8/16✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 34 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 34 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 34 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 34 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 34 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 34 times.
|
34 | else if ( !m_walkflag_simple(x+incr, y+incr) ) //legaldirs |= 0x80; //right-down |
| 16870 | { | ||
| 16871 | //zprint2("Spawn adjustment: +x (%d), +y (%d)\n", incr, incr); | ||
| 16872 | ✗ | x+=incr; y+=incr; break; | |
| 16873 | } | ||
| 16874 | 34 | else continue; | |
| 16875 | |||
| 16876 | } | ||
| 16877 | |||
| 16878 | 90 | } | |
| 16879 | |||
| 16880 | 239 | dir=up; | |
| 16881 | 239 | superman=1; | |
| 16882 | 239 | fading=fade_invisible; | |
| 16883 | 239 | hxofs=1000; | |
| 16884 | 239 | segcnt=clk; | |
| 16885 | 239 | clk=0; | |
| 16886 | //set up move history | ||
| 16887 |
2/2✓ Branch 0 taken 239 times.
✓ Branch 1 taken 1691 times.
|
1930 | for(int32_t i=0; i <= (1<<dmisc2); i++) |
| 16888 |
3/6✓ Branch 0 taken 1691 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1691 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1691 times.
✗ Branch 5 not taken.
|
1691 | prevState.push_back(std::pair<std::pair<zfix, zfix>, int32_t>(std::pair<zfix,zfix>(x,y), dir)); |
| 16889 | 239 | } | |
| 16890 | |||
| 16891 | 134485 | bool eLanmola::animate(int32_t index) | |
| 16892 | { | ||
| 16893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134485 times.
|
134485 | if(switch_hooked) return enemy::animate(index); |
| 16894 |
2/2✓ Branch 0 taken 112061 times.
✓ Branch 1 taken 22424 times.
|
134485 | if(clk==0) |
| 16895 | { | ||
| 16896 | 22424 | removearmos(x,y,ffcactivated); | |
| 16897 | 22424 | } | |
| 16898 | |||
| 16899 |
2/2✓ Branch 0 taken 1862 times.
✓ Branch 1 taken 132623 times.
|
134485 | if(clk2) |
| 16900 | { | ||
| 16901 |
2/2✓ Branch 0 taken 1764 times.
✓ Branch 1 taken 98 times.
|
1862 | if(--clk2 == 0) |
| 16902 | { | ||
| 16903 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 20 times.
|
98 | if(!dmisc3) //This checks if "segments drop items" isn't true, because if they don't drop items, then only killing the whole thing drops an item. |
| 16904 | 78 | leave_item(); | |
| 16905 | |||
| 16906 | 98 | stop_bgsfx(index); | |
| 16907 | 98 | return true; | |
| 16908 | } | ||
| 16909 | |||
| 16910 | 1764 | return false; | |
| 16911 | } | ||
| 16912 | |||
| 16913 | |||
| 16914 | //this animation style plays ALL KINDS of havoc on the Lanmola segments, since it causes | ||
| 16915 | //the direction AND x,y position of the lanmola to vary in uncertain ways. | ||
| 16916 | //I've added a complete movement history to this enemy to compensate -DD | ||
| 16917 | 132623 | constant_walk(rate,homing,spw_none); | |
| 16918 | 132623 | prevState.pop_front(); | |
| 16919 | 132623 | prevState.push_front(std::pair<std::pair<zfix, zfix>, int32_t>(std::pair<zfix, zfix>(x,y), dir)); | |
| 16920 | |||
| 16921 | // This could cause a crash with Moldorms. I didn't see the same problem | ||
| 16922 | // with Lanmolas, but it looks like it ought to be possible, so here's | ||
| 16923 | // the same solution. - Saf | ||
| 16924 |
1/2✓ Branch 0 taken 132623 times.
✗ Branch 1 not taken.
|
132623 | if(index+segcnt>=guys.Count()) |
| 16925 | ✗ | segcnt=guys.Count()-index-1; | |
| 16926 | |||
| 16927 |
2/2✓ Branch 0 taken 132623 times.
✓ Branch 1 taken 599039 times.
|
731662 | for(int32_t i=index+1; i<index+segcnt+1; i++) |
| 16928 | { | ||
| 16929 | 599039 | enemy* segment=((enemy*)guys.spr(i)); | |
| 16930 | |||
| 16931 | // More validation in case segcnt is wrong | ||
| 16932 |
1/2✓ Branch 0 taken 599039 times.
✗ Branch 1 not taken.
|
599039 | if((segment->id&0xFFF)!=(id&0xFFF)) |
| 16933 | { | ||
| 16934 | ✗ | segcnt=i-index-1; | |
| 16935 | ✗ | break; | |
| 16936 | } | ||
| 16937 | |||
| 16938 | 599039 | segment->o_tile=o_tile; | |
| 16939 | 599039 | segment->parent_script_UID = this->script_UID; | |
| 16940 |
4/4✓ Branch 0 taken 132623 times.
✓ Branch 1 taken 466416 times.
✓ Branch 2 taken 19514 times.
✓ Branch 3 taken 113109 times.
|
599039 | if((i==index+segcnt)&&(i!=index+1)) |
| 16941 | { | ||
| 16942 | 113109 | segment->dummy_int[1]=1; //tail | |
| 16943 | 113109 | } | |
| 16944 | else | ||
| 16945 | { | ||
| 16946 | 485930 | segment->dummy_int[1]=0; | |
| 16947 | } | ||
| 16948 | |||
| 16949 |
2/2✓ Branch 0 taken 598467 times.
✓ Branch 1 taken 572 times.
|
599039 | if(segment->hp <= 0) |
| 16950 | { | ||
| 16951 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 977 times.
|
1549 | for(int32_t j=i; j<index+segcnt; j++) |
| 16952 | { | ||
| 16953 | // Triple-check | ||
| 16954 |
1/2✓ Branch 0 taken 977 times.
✗ Branch 1 not taken.
|
977 | if((((enemy*)guys.spr(j+1))->id&0xFFF)!=(id&0xFFF)) |
| 16955 | { | ||
| 16956 | ✗ | segcnt=j-index+1; // Add 1 because of --segcnt below | |
| 16957 | ✗ | break; | |
| 16958 | } | ||
| 16959 | 977 | zc_swap(((enemy*)guys.spr(j))->hp,((enemy*)guys.spr(j+1))->hp); | |
| 16960 | 977 | zc_swap(((enemy*)guys.spr(j))->hclk,((enemy*)guys.spr(j+1))->hclk); | |
| 16961 | 977 | } | |
| 16962 | |||
| 16963 | 572 | ((enemy*)guys.spr(i))->hclk=33; | |
| 16964 | 572 | --segcnt; | |
| 16965 | 572 | --i; // Recheck the same index in case multiple segments died at once | |
| 16966 | 572 | } | |
| 16967 | 599039 | } | |
| 16968 | |||
| 16969 |
2/2✓ Branch 0 taken 132525 times.
✓ Branch 1 taken 98 times.
|
132623 | if(segcnt==0) |
| 16970 | { | ||
| 16971 | 98 | clk2=19; | |
| 16972 | 98 | x=guys.spr(index+1)->x; | |
| 16973 | 98 | y=guys.spr(index+1)->y; | |
| 16974 | 98 | setmapflag(mTMPNORET); | |
| 16975 | 98 | } | |
| 16976 | |||
| 16977 | //this enemy is invincible.. BUT scripts don't know that, and can "kill" it by setting the hp negative. | ||
| 16978 | //which is... disastrous. | ||
| 16979 | 132623 | hp = 1; | |
| 16980 | 132623 | return enemy::animate(index); | |
| 16981 | 134485 | } | |
| 16982 | |||
| 16983 | 2500 | esLanmola::esLanmola(zfix X,zfix Y,int32_t Id,int32_t Clk) : eBaseLanmola(X,Y,Id,Clk) | |
| 16984 | 2500 | { | |
| 16985 |
1/2✓ Branch 0 taken 1250 times.
✗ Branch 1 not taken.
|
1250 | if( !(editorflags & ENEMY_FLAG5) ) |
| 16986 | { | ||
| 16987 |
1/2✓ Branch 0 taken 1250 times.
✗ Branch 1 not taken.
|
1250 | x=64; |
| 16988 |
1/2✓ Branch 0 taken 1250 times.
✗ Branch 1 not taken.
|
1250 | y=80; |
| 16989 | 1250 | } | |
| 16990 | 1250 | int32_t incr = 16; | |
| 16991 | //Don't spawn in pits. | ||
| 16992 |
5/8✓ Branch 0 taken 1250 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1250 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1250 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 800 times.
✓ Branch 7 taken 450 times.
|
1250 | if ( m_walkflag_simple(x, y) ) |
| 16993 | { | ||
| 16994 | //zprint2("Can't spawn here.\n"); | ||
| 16995 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 620 times.
|
620 | for ( ; incr < 240; incr += 16 ) |
| 16996 | { | ||
| 16997 | //move if we spawn over a pit | ||
| 16998 | //check each direction | ||
| 16999 |
7/12✓ Branch 0 taken 620 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 620 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 620 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 620 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 620 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 20 times.
✓ Branch 11 taken 600 times.
|
620 | if ( !m_walkflag_simple(x-incr, y) ) //legaldirs |= 0x1; //left |
| 17000 | { | ||
| 17001 | //zprint2("Spawn adjustment: -x (%d)\n", incr); | ||
| 17002 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | x-=incr; break; |
| 17003 | } | ||
| 17004 |
7/12✓ Branch 0 taken 600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 600 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 600 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 600 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 600 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 140 times.
✓ Branch 11 taken 460 times.
|
600 | else if ( !m_walkflag_simple(x+incr, y) ) //legaldirs |= 0x2; //right |
| 17005 | { | ||
| 17006 | //zprint2("Spawn adjustment: +x (%d)\n", incr); | ||
| 17007 |
1/2✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
|
140 | x+=incr; break; |
| 17008 | } | ||
| 17009 |
9/16✓ Branch 0 taken 460 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 460 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 460 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 460 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 460 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 460 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 460 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 160 times.
✓ Branch 15 taken 300 times.
|
460 | else if ( !m_walkflag_simple(x-incr, y-incr) ) //legaldirs |= 0x4; //left-up |
| 17010 | { | ||
| 17011 | //zprint2("Spawn adjustment: -x (%d), -y (%d)\n", incr, incr); | ||
| 17012 |
2/4✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 160 times.
✗ Branch 3 not taken.
|
160 | x-=incr; y-=incr; break; |
| 17013 | } | ||
| 17014 |
8/16✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 300 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 300 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 300 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 300 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 300 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 300 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 300 times.
|
300 | else if ( !m_walkflag_simple(x+incr, y-incr) ) //legaldirs |= 0x8; //right-up |
| 17015 | { | ||
| 17016 | //zprint2("Spawn adjustment: +x (%d), -y (%d)\n", incr, incr); | ||
| 17017 | ✗ | x+=incr; y-=incr; break; | |
| 17018 | } | ||
| 17019 |
6/12✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 300 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 300 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 300 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 300 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 300 times.
|
300 | else if ( !m_walkflag_simple(x, y-incr) ) // legaldirs |= 0x10; //up |
| 17020 | { | ||
| 17021 | //zprint2("Spawn adjustment: -y (%d)\n", incr); | ||
| 17022 | ✗ | y -= incr; break; | |
| 17023 | } | ||
| 17024 |
6/12✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 300 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 300 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 300 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 300 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 300 times.
|
300 | else if ( !m_walkflag_simple(x, y+incr) ) //legaldirs |= 0x20; //down |
| 17025 | { | ||
| 17026 | //zprint2("Spawn adjustment: +y (%d)\n", incr); | ||
| 17027 | ✗ | y+=incr; break; | |
| 17028 | } | ||
| 17029 |
9/16✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 300 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 300 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 300 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 300 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 300 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 300 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 130 times.
✓ Branch 15 taken 170 times.
|
300 | else if ( !m_walkflag_simple(x-incr, y+incr) ) //legaldirs |= 0x40; //left-down |
| 17030 | { | ||
| 17031 | //zprint2("Spawn adjustment: -x (%d), +y (%d)\n", incr, incr); | ||
| 17032 |
2/4✓ Branch 0 taken 130 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 130 times.
✗ Branch 3 not taken.
|
130 | x-=incr; y+=incr; break; |
| 17033 | } | ||
| 17034 |
8/16✓ Branch 0 taken 170 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 170 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 170 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 170 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 170 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 170 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 170 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 170 times.
|
170 | else if ( !m_walkflag_simple(x+incr, y+incr) ) //legaldirs |= 0x80; //right-down |
| 17035 | { | ||
| 17036 | //zprint2("Spawn adjustment: +x (%d), +y (%d)\n", incr, incr); | ||
| 17037 | ✗ | x+=incr; y+=incr; break; | |
| 17038 | } | ||
| 17039 | 170 | else continue; | |
| 17040 | |||
| 17041 | } | ||
| 17042 | |||
| 17043 | 450 | } | |
| 17044 | |||
| 17045 | 1250 | hxofs=1000; | |
| 17046 | 1250 | hxsz=8; | |
| 17047 | 1250 | mainguy=false; | |
| 17048 | 1250 | count_enemy=(id<0x2000)?true:false; | |
| 17049 | |||
| 17050 | //set up move history | ||
| 17051 |
2/2✓ Branch 0 taken 1250 times.
✓ Branch 1 taken 8910 times.
|
10160 | for(int32_t i=0; i <= (1<<dmisc2); i++) |
| 17052 |
3/6✓ Branch 0 taken 8910 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8910 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8910 times.
✗ Branch 5 not taken.
|
8910 | prevState.push_back(std::pair<std::pair<zfix, zfix>, int32_t>(std::pair<zfix,zfix>(x,y), dir)); |
| 17053 | |||
| 17054 | 1250 | bgsfx = -1; | |
| 17055 | 1250 | isCore = false; | |
| 17056 | 1250 | flags&=~guy_neverret; | |
| 17057 | 1250 | } | |
| 17058 | |||
| 17059 | 609335 | bool esLanmola::animate(int32_t index) | |
| 17060 | { | ||
| 17061 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 609335 times.
|
609335 | if(switch_hooked) return enemy::animate(index); |
| 17062 | // Shouldn't be possible, but who knows | ||
| 17063 |
1/2✓ Branch 0 taken 609335 times.
✗ Branch 1 not taken.
|
609335 | if(index==0) |
| 17064 | ✗ | dying=true; | |
| 17065 | |||
| 17066 |
2/2✓ Branch 0 taken 10296 times.
✓ Branch 1 taken 599039 times.
|
609335 | if(dying) |
| 17067 | { | ||
| 17068 | 10296 | xofs=0; | |
| 17069 | |||
| 17070 |
2/2✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 8496 times.
|
10296 | if(!dmisc3) |
| 17071 | 8496 | item_set=0; | |
| 17072 | |||
| 17073 | 10296 | return Dead(index); | |
| 17074 | } | ||
| 17075 | |||
| 17076 |
2/2✓ Branch 0 taken 19310 times.
✓ Branch 1 taken 579729 times.
|
599039 | if(clk>=0) |
| 17077 | { | ||
| 17078 | 579729 | hxofs=4; | |
| 17079 | |||
| 17080 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 579729 times.
|
579729 | if(!watch) |
| 17081 | { | ||
| 17082 | 579729 | std::pair<std::pair<zfix, zfix>, int32_t> newstate = ((eBaseLanmola*)guys.spr(index-1))->prevState.front(); | |
| 17083 | 579729 | prevState.pop_front(); | |
| 17084 | 579729 | prevState.push_back(newstate); | |
| 17085 | 579729 | x = newstate.first.first; | |
| 17086 | 579729 | y = newstate.first.second; | |
| 17087 | 579729 | dir = newstate.second; | |
| 17088 | 579729 | } | |
| 17089 | 579729 | } | |
| 17090 | |||
| 17091 | 599039 | return enemy::animate(index); | |
| 17092 | 609335 | } | |
| 17093 | |||
| 17094 | 1513 | int32_t esLanmola::takehit(weapon *w, weapon* realweap) | |
| 17095 | { | ||
| 17096 |
2/2✓ Branch 0 taken 1382 times.
✓ Branch 1 taken 131 times.
|
1513 | if(enemy::takehit(w,realweap)) |
| 17097 | 1382 | return (w->id==wSBomb) ? 1 : 2; // force it to wait a frame before checking sword attacks again | |
| 17098 | |||
| 17099 | 131 | return 0; | |
| 17100 | 1513 | } | |
| 17101 | |||
| 17102 | 610611 | void esLanmola::draw(BITMAP *dest) | |
| 17103 | { | ||
| 17104 | 610611 | tile=o_tile; | |
| 17105 | 610611 | int32_t fdiv = frate/4; | |
| 17106 |
1/2✓ Branch 0 taken 610611 times.
✗ Branch 1 not taken.
|
610611 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 17107 | |||
| 17108 |
2/2✓ Branch 0 taken 337533 times.
✓ Branch 1 taken 273078 times.
|
610611 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 17109 | 610611 | efrate:((clk>=(frate>>1))?1:0); | |
| 17110 | |||
| 17111 |
2/2✓ Branch 0 taken 337533 times.
✓ Branch 1 taken 273078 times.
|
610611 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 17112 | { | ||
| 17113 |
2/2✓ Branch 0 taken 68269 times.
✓ Branch 1 taken 269264 times.
|
337533 | if(id>=0x2000) |
| 17114 | { | ||
| 17115 | 269264 | tile+=20; | |
| 17116 | |||
| 17117 |
2/2✓ Branch 0 taken 209782 times.
✓ Branch 1 taken 59482 times.
|
269264 | if(dummy_int[1]==1) |
| 17118 | { | ||
| 17119 | 59482 | tile+=20; | |
| 17120 | 59482 | } | |
| 17121 | 269264 | } | |
| 17122 | |||
| 17123 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 70158 times.
✓ Branch 2 taken 71956 times.
✓ Branch 3 taken 93557 times.
✓ Branch 4 taken 101862 times.
|
337533 | switch(dir) |
| 17124 | { | ||
| 17125 | case up: | ||
| 17126 | 70158 | flip=0; | |
| 17127 | 70158 | break; | |
| 17128 | |||
| 17129 | case down: | ||
| 17130 | 71956 | flip=0; | |
| 17131 | 71956 | tile+=4; | |
| 17132 | 71956 | break; | |
| 17133 | |||
| 17134 | case left: | ||
| 17135 | 93557 | flip=0; | |
| 17136 | 93557 | tile+=8; | |
| 17137 | 93557 | break; | |
| 17138 | |||
| 17139 | case right: | ||
| 17140 | 101862 | flip=0; | |
| 17141 | 101862 | tile+=12; | |
| 17142 | 101862 | break; | |
| 17143 | } | ||
| 17144 | |||
| 17145 | 337533 | tile+=f2; | |
| 17146 | 337533 | } | |
| 17147 | else | ||
| 17148 | { | ||
| 17149 |
2/2✓ Branch 0 taken 66631 times.
✓ Branch 1 taken 206447 times.
|
273078 | if(id>=0x2000) |
| 17150 | { | ||
| 17151 | 206447 | tile+=1; | |
| 17152 | 206447 | } | |
| 17153 | } | ||
| 17154 | |||
| 17155 |
2/2✓ Branch 0 taken 19310 times.
✓ Branch 1 taken 591301 times.
|
610611 | if(clk>=0) |
| 17156 | 591301 | enemy::draw(dest); | |
| 17157 | 610611 | } | |
| 17158 | |||
| 17159 | 116 | eManhandla::eManhandla(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,0) | |
| 17160 | 116 | { | |
| 17161 | //these are here to bypass compiler warnings about unused arguments | ||
| 17162 | 58 | Clk=Clk; | |
| 17163 | 58 | superman=1; | |
| 17164 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | dir=(zc_oldrand()&7)+8; |
| 17165 | 58 | armcnt=dmisc2?8:4;//((id==eMANHAN)?4:8); | |
| 17166 | |||
| 17167 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 58 times.
|
322 | for(int32_t i=0; i<armcnt; i++) |
| 17168 | 264 | arm[i]=i; | |
| 17169 | |||
| 17170 | 58 | fading=fade_blue_poof; | |
| 17171 | //nets+4680; | ||
| 17172 | 58 | adjusted=false; | |
| 17173 | 58 | SIZEflags = d->SIZEflags; //Probably will be buggy. -Z 12 AUG 2020 | |
| 17174 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
58 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 17175 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 17176 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 17177 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
58 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 17178 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
58 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 17179 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
58 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 17180 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
58 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 17181 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 17182 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 17183 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 17184 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
58 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 17185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
|
58 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 17186 | { | ||
| 17187 | ✗ | yofs = d->yofs+(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); | |
| 17188 | ✗ | } | |
| 17189 | |||
| 17190 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
58 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 17191 | 58 | } | |
| 17192 | |||
| 17193 | 30211 | bool eManhandla::animate(int32_t index) | |
| 17194 | { | ||
| 17195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30211 times.
|
30211 | if(switch_hooked) return enemy::animate(index); |
| 17196 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 29455 times.
|
30211 | if(dying) |
| 17197 | 756 | return Dead(index); | |
| 17198 | |||
| 17199 |
2/2✓ Branch 0 taken 28252 times.
✓ Branch 1 taken 1203 times.
|
29455 | if(clk==0) |
| 17200 | { | ||
| 17201 | 1203 | removearmos(x,y,ffcactivated); | |
| 17202 | 1203 | } | |
| 17203 | |||
| 17204 | |||
| 17205 | // check arm status, move dead ones to end of group | ||
| 17206 |
2/2✓ Branch 0 taken 92084 times.
✓ Branch 1 taken 29455 times.
|
121539 | for(int32_t i=0; i<armcnt; i++) |
| 17207 | { | ||
| 17208 | 92084 | enemy* cur_arm = ((enemy*)guys.spr(index+i+1)); | |
| 17209 |
3/4✓ Branch 0 taken 92084 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 91884 times.
|
92084 | if(!cur_arm || cur_arm->dying) |
| 17210 | { | ||
| 17211 |
2/2✓ Branch 0 taken 246 times.
✓ Branch 1 taken 200 times.
|
446 | for(int32_t j=i; j<armcnt-1; j++) |
| 17212 | { | ||
| 17213 | 246 | zc_swap(arm[j],arm[j+1]); | |
| 17214 | 246 | guys.swap(index+j+1,index+j+2); | |
| 17215 | 246 | } | |
| 17216 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 32 times.
|
200 | if((editorflags & ENEMY_FLAG6)) //They only did this in 2.10 |
| 17217 | { | ||
| 17218 | 32 | leave_item(); | |
| 17219 | 32 | } | |
| 17220 | 200 | --armcnt; | |
| 17221 | 200 | --i; | |
| 17222 | 200 | continue; | |
| 17223 | } | ||
| 17224 |
2/2✓ Branch 0 taken 91620 times.
✓ Branch 1 taken 264 times.
|
91884 | if(!adjusted) |
| 17225 | { | ||
| 17226 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 64 times.
|
264 | if(!dmisc2) |
| 17227 | { | ||
| 17228 | 200 | cur_arm->o_tile=o_tile+40; | |
| 17229 | 200 | cur_arm->parent_script_UID = this->script_UID; | |
| 17230 | 200 | } | |
| 17231 | else | ||
| 17232 | { | ||
| 17233 | 64 | cur_arm->o_tile=o_tile+160; | |
| 17234 | 64 | cur_arm->parent_script_UID = this->script_UID; | |
| 17235 | } | ||
| 17236 | 264 | } | |
| 17237 | 91884 | } | |
| 17238 | |||
| 17239 | 29455 | adjusted=true; | |
| 17240 | |||
| 17241 | // move or die | ||
| 17242 |
2/2✓ Branch 0 taken 29413 times.
✓ Branch 1 taken 42 times.
|
29455 | if(armcnt==0) |
| 17243 | 42 | hp=0; | |
| 17244 | else | ||
| 17245 | { | ||
| 17246 | // Speed starts at 0.5, and increases by 0.5 for each head lost. Max speed is 4.5. | ||
| 17247 |
1/2✓ Branch 0 taken 29413 times.
✗ Branch 1 not taken.
|
29413 | step=zc_min(zfix(4.5),(((!dmisc2)?4:8)-int64_t(armcnt))*0.5+zslongToFix(dstep*100)); |
| 17248 | 29413 | int32_t dx1=0, dy1=-8, dx2=15, dy2=15; | |
| 17249 | |||
| 17250 |
2/2✓ Branch 0 taken 26532 times.
✓ Branch 1 taken 2881 times.
|
29413 | if(!dmisc2) |
| 17251 | { | ||
| 17252 |
2/2✓ Branch 0 taken 77897 times.
✓ Branch 1 taken 26532 times.
|
104429 | for(int32_t i=0; i<armcnt; i++) |
| 17253 | { | ||
| 17254 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 18618 times.
✓ Branch 2 taken 20692 times.
✓ Branch 3 taken 19238 times.
✓ Branch 4 taken 19349 times.
|
77897 | switch(arm[i]) |
| 17255 | { | ||
| 17256 | case 0: | ||
| 17257 | 18618 | dy1=-24; | |
| 17258 | 18618 | break; | |
| 17259 | |||
| 17260 | case 1: | ||
| 17261 | 20692 | dy2=31; | |
| 17262 | 20692 | break; | |
| 17263 | |||
| 17264 | case 2: | ||
| 17265 | 19238 | dx1=-16; | |
| 17266 | 19238 | break; | |
| 17267 | |||
| 17268 | case 3: | ||
| 17269 | 19349 | dx2=31; | |
| 17270 | 19349 | break; | |
| 17271 | } | ||
| 17272 | 77897 | } | |
| 17273 | 26532 | } | |
| 17274 | else | ||
| 17275 | { | ||
| 17276 | 2881 | dx1=-8, dy1=-16, dx2=23, dy2=23; | |
| 17277 | |||
| 17278 |
2/2✓ Branch 0 taken 13987 times.
✓ Branch 1 taken 2881 times.
|
16868 | for(int32_t i=0; i<armcnt; i++) |
| 17279 | { | ||
| 17280 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 4279 times.
✓ Branch 2 taken 3184 times.
✓ Branch 3 taken 2549 times.
✓ Branch 4 taken 3975 times.
|
13987 | switch(arm[i]&3) |
| 17281 | { | ||
| 17282 | case 0: | ||
| 17283 | 4279 | dy1=-32; | |
| 17284 | 4279 | break; | |
| 17285 | |||
| 17286 | case 1: | ||
| 17287 | 3184 | dy2=39; | |
| 17288 | 3184 | break; | |
| 17289 | |||
| 17290 | case 2: | ||
| 17291 | 2549 | dx1=-24; | |
| 17292 | 2549 | break; | |
| 17293 | |||
| 17294 | case 3: | ||
| 17295 | 3975 | dx2=39; | |
| 17296 | 3975 | break; | |
| 17297 | } | ||
| 17298 | 13987 | } | |
| 17299 | } | ||
| 17300 | |||
| 17301 | 29413 | variable_walk_8(rate,homing,hrate,spw_floater,dx1,dy1,dx2,dy2); | |
| 17302 | |||
| 17303 |
2/2✓ Branch 0 taken 91884 times.
✓ Branch 1 taken 29413 times.
|
121297 | for(int32_t i=0; i<armcnt; i++) |
| 17304 | { | ||
| 17305 | 91884 | zfix dx=(zfix)0,dy=(zfix)0; | |
| 17306 | |||
| 17307 |
2/2✓ Branch 0 taken 77897 times.
✓ Branch 1 taken 13987 times.
|
91884 | if(!dmisc2) |
| 17308 | { | ||
| 17309 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 18618 times.
✓ Branch 2 taken 20692 times.
✓ Branch 3 taken 19238 times.
✓ Branch 4 taken 19349 times.
|
77897 | switch(arm[i]) |
| 17310 | { | ||
| 17311 | case 0: | ||
| 17312 | 18618 | dy=-16; | |
| 17313 | 18618 | break; | |
| 17314 | |||
| 17315 | case 1: | ||
| 17316 | 20692 | dy=16; | |
| 17317 | 20692 | break; | |
| 17318 | |||
| 17319 | case 2: | ||
| 17320 | 19238 | dx=-16; | |
| 17321 | 19238 | break; | |
| 17322 | |||
| 17323 | case 3: | ||
| 17324 | 19349 | dx=16; | |
| 17325 | 19349 | break; | |
| 17326 | } | ||
| 17327 | 77897 | } | |
| 17328 | else | ||
| 17329 | { | ||
| 17330 |
8/9✗ Branch 0 not taken.
✓ Branch 1 taken 1680 times.
✓ Branch 2 taken 1789 times.
✓ Branch 3 taken 1292 times.
✓ Branch 4 taken 2015 times.
✓ Branch 5 taken 2599 times.
✓ Branch 6 taken 1395 times.
✓ Branch 7 taken 1257 times.
✓ Branch 8 taken 1960 times.
|
13987 | switch(arm[i]) |
| 17331 | { | ||
| 17332 | case 0: | ||
| 17333 | 1680 | dy=-24; | |
| 17334 | 1680 | dx=-8; | |
| 17335 | 1680 | break; | |
| 17336 | |||
| 17337 | case 1: | ||
| 17338 | 1789 | dy=24; | |
| 17339 | 1789 | dx=8; | |
| 17340 | 1789 | break; | |
| 17341 | |||
| 17342 | case 2: | ||
| 17343 | 1292 | dx=-24; | |
| 17344 | 1292 | dy=8; | |
| 17345 | 1292 | break; | |
| 17346 | |||
| 17347 | case 3: | ||
| 17348 | 2015 | dx=24; | |
| 17349 | 2015 | dy=-8; | |
| 17350 | 2015 | break; | |
| 17351 | |||
| 17352 | case 4: | ||
| 17353 | 2599 | dy=-24; | |
| 17354 | 2599 | dx=8; | |
| 17355 | 2599 | break; | |
| 17356 | |||
| 17357 | case 5: | ||
| 17358 | 1395 | dy=24; | |
| 17359 | 1395 | dx=-8; | |
| 17360 | 1395 | break; | |
| 17361 | |||
| 17362 | case 6: | ||
| 17363 | 1257 | dx=-24; | |
| 17364 | 1257 | dy=-8; | |
| 17365 | 1257 | break; | |
| 17366 | |||
| 17367 | case 7: | ||
| 17368 | 1960 | dx=24; | |
| 17369 | 1960 | dy=8; | |
| 17370 | 1960 | break; | |
| 17371 | } | ||
| 17372 | } | ||
| 17373 | |||
| 17374 | 91884 | guys.spr(index+i+1)->x = x+dx; | |
| 17375 | 91884 | guys.spr(index+i+1)->y = y+dy; | |
| 17376 | 91884 | } | |
| 17377 | } | ||
| 17378 | |||
| 17379 | 29455 | return enemy::animate(index); | |
| 17380 | 30211 | } | |
| 17381 | |||
| 17382 | |||
| 17383 | 1300 | int32_t eManhandla::takehit(weapon *w, weapon* realweap) | |
| 17384 | { | ||
| 17385 | 1300 | int32_t wpnId = w->id; | |
| 17386 | |||
| 17387 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1300 times.
|
1300 | if(dying) |
| 17388 | ✗ | return 0; | |
| 17389 | |||
| 17390 |
3/4✓ Branch 0 taken 850 times.
✓ Branch 1 taken 433 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
1300 | switch(wpnId) |
| 17391 | { | ||
| 17392 | case wBomb: | ||
| 17393 | case wSBomb: | ||
| 17394 | case wSword: | ||
| 17395 | case wHammer: | ||
| 17396 | case wWand: | ||
| 17397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 433 times.
|
433 | if (get_bit(quest_rules, qr_MANHANDLA_BLOCK_SFX)) sfx(WAV_EHIT,pan(int32_t(x))); |
| 17398 | |||
| 17399 | case wLitBomb: | ||
| 17400 | case wLitSBomb: | ||
| 17401 | case wBait: | ||
| 17402 | case wWhistle: | ||
| 17403 | case wFire: | ||
| 17404 | case wWind: | ||
| 17405 | case wSSparkle: | ||
| 17406 | case wFSparkle: | ||
| 17407 | case wPhantom: | ||
| 17408 | 1283 | return 0; | |
| 17409 | |||
| 17410 | case wHookshot: | ||
| 17411 | case wBrang: | ||
| 17412 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 17413 | ✗ | break; | |
| 17414 | |||
| 17415 | default: | ||
| 17416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if (get_bit(quest_rules, qr_MANHANDLA_BLOCK_SFX)) sfx(WAV_EHIT,pan(int32_t(x))); |
| 17417 | ✗ | else sfx(WAV_CHINK,pan(int32_t(x))); | |
| 17418 | |||
| 17419 | 17 | } | |
| 17420 | |||
| 17421 | 17 | return 1; | |
| 17422 | 1300 | } | |
| 17423 | |||
| 17424 | 30209 | void eManhandla::draw(BITMAP *dest) | |
| 17425 | { | ||
| 17426 | 30209 | tile=o_tile; | |
| 17427 | 30209 | int32_t fdiv = frate/4; | |
| 17428 |
1/2✓ Branch 0 taken 30209 times.
✗ Branch 1 not taken.
|
30209 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 17429 | |||
| 17430 |
2/2✓ Branch 0 taken 21250 times.
✓ Branch 1 taken 8959 times.
|
30209 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 17431 | 30209 | efrate:((clk>=(frate>>1))?1:0); | |
| 17432 | |||
| 17433 |
2/2✓ Branch 0 taken 21250 times.
✓ Branch 1 taken 8959 times.
|
30209 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 17434 | { | ||
| 17435 |
2/2✓ Branch 0 taken 2518 times.
✓ Branch 1 taken 18732 times.
|
21250 | if(!dmisc2) |
| 17436 | { | ||
| 17437 |
8/9✓ Branch 0 taken 2400 times.
✓ Branch 1 taken 2084 times.
✓ Branch 2 taken 2751 times.
✓ Branch 3 taken 2878 times.
✓ Branch 4 taken 1783 times.
✓ Branch 5 taken 1846 times.
✓ Branch 6 taken 1929 times.
✓ Branch 7 taken 3061 times.
✗ Branch 8 not taken.
|
18732 | switch(dir-8) //directions get screwed up after 8. *shrug* |
| 17438 | { | ||
| 17439 | case up: //u | ||
| 17440 | 2400 | flip=0; | |
| 17441 | 2400 | break; | |
| 17442 | |||
| 17443 | case l_up: //d | ||
| 17444 | 2084 | flip=0; | |
| 17445 | 2084 | tile+=4; | |
| 17446 | 2084 | break; | |
| 17447 | |||
| 17448 | case l_down: //l | ||
| 17449 | 2751 | flip=0; | |
| 17450 | 2751 | tile+=8; | |
| 17451 | 2751 | break; | |
| 17452 | |||
| 17453 | case left: //r | ||
| 17454 | 2878 | flip=0; | |
| 17455 | 2878 | tile+=12; | |
| 17456 | 2878 | break; | |
| 17457 | |||
| 17458 | case r_down: //ul | ||
| 17459 | 1783 | flip=0; | |
| 17460 | 1783 | tile+=20; | |
| 17461 | 1783 | break; | |
| 17462 | |||
| 17463 | case down: //ur | ||
| 17464 | 1846 | flip=0; | |
| 17465 | 1846 | tile+=24; | |
| 17466 | 1846 | break; | |
| 17467 | |||
| 17468 | case r_up: //dl | ||
| 17469 | 1929 | flip=0; | |
| 17470 | 1929 | tile+=28; | |
| 17471 | 1929 | break; | |
| 17472 | |||
| 17473 | case right: //dr | ||
| 17474 | 3061 | flip=0; | |
| 17475 | 3061 | tile+=32; | |
| 17476 | 3061 | break; | |
| 17477 | } | ||
| 17478 | |||
| 17479 | 18732 | tile+=f2; | |
| 17480 | 18732 | enemy::draw(dest); | |
| 17481 | 18732 | } //manhandla 2, big body | |
| 17482 | else | ||
| 17483 | { | ||
| 17484 | |||
| 17485 |
8/9✗ Branch 0 not taken.
✓ Branch 1 taken 357 times.
✓ Branch 2 taken 483 times.
✓ Branch 3 taken 500 times.
✓ Branch 4 taken 315 times.
✓ Branch 5 taken 196 times.
✓ Branch 6 taken 215 times.
✓ Branch 7 taken 164 times.
✓ Branch 8 taken 288 times.
|
2518 | switch(dir-8) //directions get screwed up after 8. *shrug* |
| 17486 | { | ||
| 17487 | case up: //u | ||
| 17488 | 357 | flip=0; | |
| 17489 | 357 | break; | |
| 17490 | |||
| 17491 | case l_up: //d | ||
| 17492 | 483 | flip=0; | |
| 17493 | 483 | tile+=8; | |
| 17494 | 483 | break; | |
| 17495 | |||
| 17496 | case l_down: //l | ||
| 17497 | 500 | flip=0; | |
| 17498 | 500 | tile+=40; | |
| 17499 | 500 | break; | |
| 17500 | |||
| 17501 | case left: //r | ||
| 17502 | 315 | flip=0; | |
| 17503 | 315 | tile+=48; | |
| 17504 | 315 | break; | |
| 17505 | |||
| 17506 | case r_down: //ul | ||
| 17507 | 196 | flip=0; | |
| 17508 | 196 | tile+=80; | |
| 17509 | 196 | break; | |
| 17510 | |||
| 17511 | case down: //ur | ||
| 17512 | 215 | flip=0; | |
| 17513 | 215 | tile+=88; | |
| 17514 | 215 | break; | |
| 17515 | |||
| 17516 | case r_up: //dl | ||
| 17517 | 164 | flip=0; | |
| 17518 | 164 | tile+=120; | |
| 17519 | 164 | break; | |
| 17520 | |||
| 17521 | case right: //dr | ||
| 17522 | 288 | flip=0; | |
| 17523 | 288 | tile+=128; | |
| 17524 | 288 | break; | |
| 17525 | } | ||
| 17526 | |||
| 17527 | 2518 | tile+=(f2*2); | |
| 17528 | 2518 | xofs-=8; | |
| 17529 | 2518 | yofs-=8; | |
| 17530 | 2518 | drawblock(dest,15); | |
| 17531 | 2518 | xofs+=8; | |
| 17532 | 2518 | yofs+=8; | |
| 17533 | } | ||
| 17534 | 21250 | } | |
| 17535 | else | ||
| 17536 | { | ||
| 17537 |
2/2✓ Branch 0 taken 515 times.
✓ Branch 1 taken 8444 times.
|
8959 | if(!dmisc2) |
| 17538 | { | ||
| 17539 | 8444 | enemy::draw(dest); | |
| 17540 | 8444 | } | |
| 17541 | else | ||
| 17542 | { | ||
| 17543 | 515 | xofs-=8; | |
| 17544 | 515 | yofs-=8; | |
| 17545 | 515 | enemy::draw(dest); | |
| 17546 | 515 | xofs+=16; | |
| 17547 | 515 | enemy::draw(dest); | |
| 17548 | 515 | yofs+=16; | |
| 17549 | 515 | enemy::draw(dest); | |
| 17550 | 515 | xofs-=16; | |
| 17551 | 515 | enemy::draw(dest); | |
| 17552 | 515 | xofs+=8; | |
| 17553 | 515 | yofs-=8; | |
| 17554 | } | ||
| 17555 | } | ||
| 17556 | 30209 | } | |
| 17557 | |||
| 17558 | 528 | esManhandla::esManhandla(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) | |
| 17559 | 528 | { | |
| 17560 | 264 | id=misc=clk; | |
| 17561 | 264 | dir = clk & 3; | |
| 17562 | 264 | clk=0; | |
| 17563 | 264 | mainguy=count_enemy=false; | |
| 17564 | 264 | dummy_bool[0]=false; | |
| 17565 | 264 | item_set=0; | |
| 17566 | 264 | bgsfx=-1; | |
| 17567 | 264 | deadsfx = WAV_EDEAD; | |
| 17568 | 264 | flags &= (~guy_neverret); | |
| 17569 | 264 | isCore = false; | |
| 17570 | //Probably will be buggy. -Z 12 AUG 2020 | ||
| 17571 | 264 | SIZEflags = d->SIZEflags; | |
| 17572 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
264 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 17573 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 17574 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 17575 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
264 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 17576 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
264 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 17577 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
264 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 17578 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
264 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 17579 |
1/2✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
|
264 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 17580 |
1/2✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
|
264 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 17581 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 17582 |
1/4✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
264 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = d->xofs; |
| 17583 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
|
264 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 17584 | { | ||
| 17585 | ✗ | yofs = d->yofs+(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); | |
| 17586 | ✗ | } | |
| 17587 | |||
| 17588 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
264 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = d->zofs; |
| 17589 | 264 | } | |
| 17590 | |||
| 17591 | 95484 | bool esManhandla::animate(int32_t index) | |
| 17592 | { | ||
| 17593 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 95484 times.
|
95484 | if(switch_hooked) return enemy::animate(index); |
| 17594 |
2/2✓ Branch 0 taken 3600 times.
✓ Branch 1 taken 91884 times.
|
95484 | if(dying) |
| 17595 | 3600 | return Dead(index); | |
| 17596 | |||
| 17597 |
2/2✓ Branch 0 taken 5865 times.
✓ Branch 1 taken 86019 times.
|
91884 | if(clk==0) |
| 17598 | { | ||
| 17599 | 5865 | removearmos(x,y,ffcactivated); | |
| 17600 | 5865 | } | |
| 17601 | |||
| 17602 |
2/2✓ Branch 0 taken 78632 times.
✓ Branch 1 taken 13252 times.
|
91884 | if(--clk2<=0) |
| 17603 | { | ||
| 17604 | 13252 | clk2=unsigned(zc_oldrand())%5+5; | |
| 17605 | 13252 | clk3^=1; | |
| 17606 | 13252 | } | |
| 17607 | |||
| 17608 |
2/2✓ Branch 0 taken 725 times.
✓ Branch 1 taken 91159 times.
|
91884 | if(!(zc_oldrand()&127)) |
| 17609 | { | ||
| 17610 | 725 | addEwpn(x,y,z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 17611 | 725 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 17612 | 725 | } | |
| 17613 | |||
| 17614 | 91884 | return enemy::animate(index); | |
| 17615 | 95484 | } | |
| 17616 | |||
| 17617 | 95476 | void esManhandla::draw(BITMAP *dest) | |
| 17618 | { | ||
| 17619 | 95476 | tile=o_tile; | |
| 17620 | 95476 | int32_t fdiv = frate/4; | |
| 17621 |
1/2✓ Branch 0 taken 95476 times.
✗ Branch 1 not taken.
|
95476 | int32_t efrate = fdiv == 0 ? 0 : clk/fdiv; |
| 17622 |
2/2✓ Branch 0 taken 70295 times.
✓ Branch 1 taken 25181 times.
|
95476 | int32_t f2=get_bit(quest_rules,qr_NEWENEMYTILES)? |
| 17623 | 95476 | efrate:((clk>=(frate>>1))?1:0); | |
| 17624 | |||
| 17625 |
2/2✓ Branch 0 taken 70295 times.
✓ Branch 1 taken 25181 times.
|
95476 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 17626 | { | ||
| 17627 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 16874 times.
✓ Branch 2 taken 18626 times.
✓ Branch 3 taken 17275 times.
✓ Branch 4 taken 17520 times.
|
70295 | switch(misc&3) |
| 17628 | { | ||
| 17629 | case up: | ||
| 17630 | 16874 | break; | |
| 17631 | |||
| 17632 | case down: | ||
| 17633 | 18626 | tile+=4; | |
| 17634 | 18626 | break; | |
| 17635 | |||
| 17636 | case left: | ||
| 17637 | 17275 | tile+=8; | |
| 17638 | 17275 | break; | |
| 17639 | |||
| 17640 | case right: | ||
| 17641 | 17520 | tile+=12; | |
| 17642 | 17520 | break; | |
| 17643 | } | ||
| 17644 | |||
| 17645 | 70295 | tile+=f2; | |
| 17646 | 70295 | } | |
| 17647 | else | ||
| 17648 | { | ||
| 17649 |
4/5✓ Branch 0 taken 6148 times.
✓ Branch 1 taken 6702 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6921 times.
✓ Branch 4 taken 5410 times.
|
25181 | switch(misc&3) |
| 17650 | { | ||
| 17651 | case down: | ||
| 17652 | 6148 | flip=2; | |
| 17653 | |||
| 17654 | [[fallthrough]]; | ||
| 17655 | case up: | ||
| 17656 | 13069 | tile=(clk3)?188:189; | |
| 17657 | 13069 | break; | |
| 17658 | |||
| 17659 | case right: | ||
| 17660 | 6702 | flip=1; | |
| 17661 | [[fallthrough]]; | ||
| 17662 | |||
| 17663 | case left: | ||
| 17664 | 12112 | tile=(clk3)?186:187; | |
| 17665 | 12112 | break; | |
| 17666 | } | ||
| 17667 | } | ||
| 17668 | |||
| 17669 | 95476 | enemy::draw(dest); | |
| 17670 | 95476 | } | |
| 17671 | |||
| 17672 | 176 | eGleeok::eGleeok(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk) //enemy((zfix)120,(zfix)48,Id,Clk) | |
| 17673 | 176 | { | |
| 17674 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | if ( !(editorflags & ENEMY_FLAG5) ) |
| 17675 | { | ||
| 17676 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | x = 120; |
| 17677 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | y = 48; |
| 17678 | 88 | } | |
| 17679 | else | ||
| 17680 | { | ||
| 17681 | ✗ | if ( !(editorflags & ENEMY_FLAG6) ) | |
| 17682 | { | ||
| 17683 | ✗ | x = X; y = Y; | |
| 17684 | ✗ | } | |
| 17685 | else | ||
| 17686 | { | ||
| 17687 | ✗ | x = X+8; y = Y; | |
| 17688 | } | ||
| 17689 | } | ||
| 17690 | 88 | hzsz = 32; // can't be jumped. | |
| 17691 | 88 | flameclk=0; | |
| 17692 | 88 | misc=clk; // total head count | |
| 17693 | 88 | clk3=clk; // live head count | |
| 17694 | 88 | clk=0; | |
| 17695 | 88 | clk2=60; // fire ball clock | |
| 17696 | // hp=(guysbuf[eGLEEOK2+(misc-2)].misc2)*(misc-1)*game->get_hero_dmgmult()+guysbuf[eGLEEOK2+(misc-2)].hp; | ||
| 17697 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | hp=(guysbuf[id&0xFFF].misc2)*(misc-1)*game->get_hero_dmgmult()+guysbuf[id&0xFFF].hp; |
| 17698 | 88 | dir = down; | |
| 17699 | 88 | hxofs=4; | |
| 17700 | 88 | hxsz=8; | |
| 17701 | // frate=17*4; | ||
| 17702 | 88 | fading=fade_blue_poof; | |
| 17703 | //nets+5420; | ||
| 17704 |
3/4✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
✓ Branch 3 taken 23 times.
|
88 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 17705 | { | ||
| 17706 | /* | ||
| 17707 | necktile=o_tile+8; | ||
| 17708 | if (dmisc3) | ||
| 17709 | { | ||
| 17710 | necktile+=8; | ||
| 17711 | } | ||
| 17712 | */ | ||
| 17713 | 65 | necktile=o_tile+dmisc6; | |
| 17714 | 65 | } | |
| 17715 | else | ||
| 17716 | { | ||
| 17717 | 23 | necktile=s_tile; | |
| 17718 | } | ||
| 17719 | 88 | } | |
| 17720 | |||
| 17721 | 67285 | bool eGleeok::animate(int32_t index) | |
| 17722 | { | ||
| 17723 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67285 times.
|
67285 | if(switch_hooked) return enemy::animate(index); |
| 17724 |
2/2✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 66079 times.
|
67285 | if(dying) |
| 17725 | 1206 | return Dead(index); | |
| 17726 | |||
| 17727 |
2/2✓ Branch 0 taken 65778 times.
✓ Branch 1 taken 301 times.
|
66079 | if(clk==0) |
| 17728 | { | ||
| 17729 | 301 | removearmos(x,y,ffcactivated); | |
| 17730 | 301 | } | |
| 17731 | |||
| 17732 | // Check if a head was killed somehow... | ||
| 17733 |
2/2✓ Branch 0 taken 34806 times.
✓ Branch 1 taken 31273 times.
|
66079 | if(index+1+clk3>=guys.Count()) |
| 17734 | 31273 | clk3=guys.Count()-index-1; | |
| 17735 |
2/2✓ Branch 0 taken 13804 times.
✓ Branch 1 taken 52275 times.
|
66079 | if(index+1+misc>=guys.Count()) |
| 17736 | 52275 | misc=guys.Count()-index-1; | |
| 17737 | |||
| 17738 | //fix for the "kill all enemies" item | ||
| 17739 |
2/2✓ Branch 0 taken 66073 times.
✓ Branch 1 taken 6 times.
|
66079 | if(hp==-1000) |
| 17740 | { | ||
| 17741 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
18 | for(int32_t i=0; i<clk3; ++i) |
| 17742 | { | ||
| 17743 | // I haven't seen this fail, but it seems like it ought to be | ||
| 17744 | // possible, so I'm checking for it. - Saf | ||
| 17745 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if((((enemy*)guys.spr(index+i+1))->id&0xFFF)!=(id&0xFFF)) |
| 17746 | ✗ | break; | |
| 17747 | 12 | ((enemy*)guys.spr(index+i+1))->hp=1; // re-animate each head, | |
| 17748 | 12 | ((enemy*)guys.spr(index+i+1))->misc = -1; // disconnect it, | |
| 17749 | 12 | ((enemy*)guys.spr(index+i+1))->animate(index+i+1); // let it animate one frame, | |
| 17750 | 12 | ((enemy*)guys.spr(index+i+1))->hp=-1000; // and kill it for good | |
| 17751 | 12 | } | |
| 17752 | |||
| 17753 | 6 | clk3=0; | |
| 17754 | |||
| 17755 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
18 | for(int32_t i=0; i<misc; i++) |
| 17756 | { | ||
| 17757 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if((((enemy*)guys.spr(index+i+1))->id&0xFFF)!=(id&0xFFF)) |
| 17758 | ✗ | break; | |
| 17759 | 12 | ((enemy*)guys.spr(index+i+1))->misc = -2; // give the signal to disappear | |
| 17760 | 12 | } | |
| 17761 | 6 | } | |
| 17762 | |||
| 17763 |
2/2✓ Branch 0 taken 152852 times.
✓ Branch 1 taken 66079 times.
|
218931 | for(int32_t i=0; i<clk3; i++) |
| 17764 | { | ||
| 17765 | 152852 | enemy *head = ((enemy*)guys.spr(index+i+1)); | |
| 17766 | 152852 | head->dummy_int[1]=necktile; | |
| 17767 | 152852 | head->parent_script_UID = this->script_UID; | |
| 17768 | |||
| 17769 |
2/2✓ Branch 0 taken 98803 times.
✓ Branch 1 taken 54049 times.
|
152852 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 17770 | { | ||
| 17771 | 98803 | head->dummy_int[2]=o_tile+dmisc8; //connected head tile | |
| 17772 | 98803 | head->dummy_int[3]=o_tile+dmisc9; //flying head tile | |
| 17773 | 98803 | } | |
| 17774 | else | ||
| 17775 | { | ||
| 17776 | 54049 | head->dummy_int[2]=necktile+1; //connected head tile | |
| 17777 | 54049 | head->dummy_int[3]=necktile+2; //flying head tile | |
| 17778 | } | ||
| 17779 | |||
| 17780 | 152852 | head->dmisc5=dmisc5; //neck segments | |
| 17781 | |||
| 17782 | /* | ||
| 17783 | if (dmisc3) | ||
| 17784 | { | ||
| 17785 | head->dummy_bool[0]=true; | ||
| 17786 | } | ||
| 17787 | */ | ||
| 17788 |
2/2✓ Branch 0 taken 150189 times.
✓ Branch 1 taken 2663 times.
|
152852 | if(head->hclk) |
| 17789 | { | ||
| 17790 |
2/2✓ Branch 0 taken 2118 times.
✓ Branch 1 taken 545 times.
|
2663 | if(hclk==0) |
| 17791 | { | ||
| 17792 | 545 | hp -= 1000 - head->hp; | |
| 17793 | 545 | hclk = 33; | |
| 17794 | |||
| 17795 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 545 times.
|
545 | if(hitsfx>0) sfx(hitsfx,pan(int32_t(head->x))); |
| 17796 | |||
| 17797 | 545 | sfx(WAV_EHIT,pan(int32_t(head->x))); | |
| 17798 | 545 | } | |
| 17799 | |||
| 17800 | 2663 | head->hclk = 0; | |
| 17801 | 2663 | } | |
| 17802 | |||
| 17803 | // Must be set in case of naughty ZScripts | ||
| 17804 | 152852 | head->hp = 1000; | |
| 17805 | 152852 | } | |
| 17806 | |||
| 17807 |
2/2✓ Branch 0 taken 65893 times.
✓ Branch 1 taken 186 times.
|
66079 | if(hp<=(guysbuf[id&0xFFF].misc2)*(clk3-1)*game->get_hero_dmgmult()) |
| 17808 | { | ||
| 17809 | 186 | ((enemy*)guys.spr(index+clk3))->misc = -1; // give signal to fly off | |
| 17810 | 186 | hp=(guysbuf[id&0xFFF].misc2)*(--clk3)*game->get_hero_dmgmult(); | |
| 17811 | 186 | } | |
| 17812 | |||
| 17813 |
2/2✓ Branch 0 taken 18578 times.
✓ Branch 1 taken 47501 times.
|
66079 | if(!dmisc3) |
| 17814 | { | ||
| 17815 |
4/4✓ Branch 0 taken 2631 times.
✓ Branch 1 taken 44870 times.
✓ Branch 2 taken 641 times.
✓ Branch 3 taken 1990 times.
|
47501 | if(++clk2>72 && !(zc_oldrand()&3)) |
| 17816 | { | ||
| 17817 | 641 | int32_t i=zc_oldrand()%misc; | |
| 17818 | 641 | enemy *head = ((enemy*)guys.spr(index+i+1)); | |
| 17819 | 641 | addEwpn(head->x,head->y,head->z,wpn,3,wdp,dir,getUID(), 0, head->fakez); | |
| 17820 | 641 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 17821 | 641 | clk2=0; | |
| 17822 | 641 | } | |
| 17823 | 47501 | } | |
| 17824 | else | ||
| 17825 | { | ||
| 17826 |
4/4✓ Branch 0 taken 779 times.
✓ Branch 1 taken 17799 times.
✓ Branch 2 taken 598 times.
✓ Branch 3 taken 181 times.
|
18578 | if(++clk2>100 && !(zc_oldrand()&3)) |
| 17827 | { | ||
| 17828 | 181 | enemy *head = ((enemy*)guys.spr(zc_oldrand()%misc+index+1)); | |
| 17829 | 181 | head->timer=zc_oldrand()%50+50; | |
| 17830 | 181 | clk2=0; | |
| 17831 | 181 | } | |
| 17832 | } | ||
| 17833 | |||
| 17834 |
3/4✓ Branch 0 taken 67 times.
✓ Branch 1 taken 66012 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 67 times.
|
66079 | if((hp<=0 && !immortal)) |
| 17835 | { | ||
| 17836 |
2/2✓ Branch 0 taken 180 times.
✓ Branch 1 taken 67 times.
|
247 | for(int32_t i=0; i<misc; i++) |
| 17837 | 180 | ((enemy*)guys.spr(index+i+1))->misc = -2; // give the signal to disappear | |
| 17838 | |||
| 17839 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 64 times.
|
67 | if(flags&guy_neverret) never_return(index); |
| 17840 | 67 | } | |
| 17841 | |||
| 17842 | 66079 | return enemy::animate(index); | |
| 17843 | 67285 | } | |
| 17844 | |||
| 17845 | 150 | int32_t eGleeok::takehit(weapon*,weapon*) | |
| 17846 | { | ||
| 17847 | 150 | return 0; | |
| 17848 | } | ||
| 17849 | |||
| 17850 | 67602 | void eGleeok::draw(BITMAP *dest) | |
| 17851 | { | ||
| 17852 | 67602 | tile=o_tile; | |
| 17853 | |||
| 17854 |
2/2✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 66396 times.
|
67602 | if(dying) |
| 17855 | { | ||
| 17856 | 1206 | enemy::draw(dest); | |
| 17857 | 1206 | return; | |
| 17858 | } | ||
| 17859 | |||
| 17860 | 66396 | int32_t f=clk/17; | |
| 17861 | |||
| 17862 |
2/2✓ Branch 0 taken 43721 times.
✓ Branch 1 taken 22675 times.
|
66396 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 17863 | { | ||
| 17864 | // body | ||
| 17865 | 43721 | xofs=-8; | |
| 17866 | 43721 | yofs=32; | |
| 17867 | |||
| 17868 |
4/4✓ Branch 0 taken 33457 times.
✓ Branch 1 taken 3611 times.
✓ Branch 2 taken 3364 times.
✓ Branch 3 taken 3289 times.
|
43721 | switch(f) |
| 17869 | |||
| 17870 | { | ||
| 17871 | case 0: | ||
| 17872 | 3611 | tile+=0; | |
| 17873 | 3611 | break; | |
| 17874 | |||
| 17875 | case 1: | ||
| 17876 | 3364 | tile+=2; | |
| 17877 | 3364 | break; | |
| 17878 | |||
| 17879 | case 2: | ||
| 17880 | 3289 | tile+=4; | |
| 17881 | 3289 | break; | |
| 17882 | |||
| 17883 | default: | ||
| 17884 | 33457 | tile+=6; | |
| 17885 | 33457 | break; | |
| 17886 | } | ||
| 17887 | 43721 | } | |
| 17888 | else | ||
| 17889 | { | ||
| 17890 | // body | ||
| 17891 | 22675 | xofs=-8; | |
| 17892 | 22675 | yofs=32; | |
| 17893 | |||
| 17894 |
3/3✓ Branch 0 taken 19415 times.
✓ Branch 1 taken 1645 times.
✓ Branch 2 taken 1615 times.
|
22675 | switch(f) |
| 17895 | { | ||
| 17896 | case 0: | ||
| 17897 | 1645 | tile+=0; | |
| 17898 | 1645 | break; | |
| 17899 | |||
| 17900 | case 2: | ||
| 17901 | 1615 | tile+=4; | |
| 17902 | 1615 | break; | |
| 17903 | |||
| 17904 | default: | ||
| 17905 | 19415 | tile+=2; | |
| 17906 | 19415 | break; | |
| 17907 | } | ||
| 17908 | } | ||
| 17909 | |||
| 17910 | 66396 | enemy::drawblock(dest,15); | |
| 17911 | 67602 | } | |
| 17912 | |||
| 17913 | 67602 | void eGleeok::draw2(BITMAP *dest) | |
| 17914 | { | ||
| 17915 | // the neck stub | ||
| 17916 | 67602 | tile=necktile; | |
| 17917 | 67602 | xofs=0; | |
| 17918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67602 times.
|
67602 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 17919 | |||
| 17920 |
2/2✓ Branch 0 taken 23071 times.
✓ Branch 1 taken 44531 times.
|
67602 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 17921 | { | ||
| 17922 | 44531 | tile+=((clk&24)>>3); | |
| 17923 | 44531 | } | |
| 17924 | |||
| 17925 |
3/4✓ Branch 0 taken 66396 times.
✓ Branch 1 taken 1206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 66396 times.
|
67602 | if(hp > 0 && !dont_draw()) |
| 17926 | { | ||
| 17927 |
3/4✓ Branch 0 taken 637 times.
✓ Branch 1 taken 65759 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 637 times.
|
66396 | if((tmpscr->flags3&fINVISROOM)&& !(current_item(itype_amulet))) |
| 17928 | ✗ | sprite::drawcloaked(dest); | |
| 17929 | else | ||
| 17930 | 66396 | sprite::draw(dest); | |
| 17931 | 66396 | } | |
| 17932 | 67602 | } | |
| 17933 | |||
| 17934 |
4/8✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 259 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 259 times.
✗ Branch 7 not taken.
|
777 | esGleeok::esGleeok(zfix X,zfix Y,int32_t Id,int32_t Clk, sprite * prnt) : enemy(X,Y,Id,Clk), parent(prnt) |
| 17935 | 518 | { | |
| 17936 |
1/2✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
|
259 | xoffset=0; |
| 17937 |
2/4✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
|
259 | yoffset=(zfix)((dmisc5*4+2)); |
| 17938 | // dummy_bool[0]=false; | ||
| 17939 | 259 | timer=0; | |
| 17940 | /* fixing */ | ||
| 17941 | 259 | hp=1000; | |
| 17942 |
1/2✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
|
259 | step=1; |
| 17943 | 259 | item_set=0; | |
| 17944 | //x=120; y=70; | ||
| 17945 |
4/8✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 259 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 259 times.
✗ Branch 7 not taken.
|
259 | x = xoffset+parent->x; |
| 17946 |
4/8✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 259 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 259 times.
✗ Branch 7 not taken.
|
259 | y = yoffset+parent->y; |
| 17947 | 259 | hxofs=4; | |
| 17948 | 259 | hxsz=8; | |
| 17949 |
3/6✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 259 times.
✓ Branch 4 taken 259 times.
✗ Branch 5 not taken.
|
259 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 17950 | 259 | clk2=clk; // how int32_t to wait before moving first time | |
| 17951 | 259 | clk=0; | |
| 17952 | 259 | mainguy=count_enemy=false; | |
| 17953 |
1/2✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
|
259 | dir=zc_oldrand(); |
| 17954 | 259 | clk3=((dir&2)>>1)+2; // left or right | |
| 17955 | 259 | dir&=1; // up or down | |
| 17956 |
1/2✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
|
259 | dmisc5=vbound(dmisc5,1,255); |
| 17957 | 259 | isCore = false; | |
| 17958 |
1/2✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
|
259 | parentCore = parent->getUID(); |
| 17959 |
2/2✓ Branch 0 taken 1036 times.
✓ Branch 1 taken 259 times.
|
1295 | for(int32_t i=0; i<dmisc5; i++) |
| 17960 | { | ||
| 17961 | 1036 | nxoffset[i] = 0; | |
| 17962 | 1036 | nyoffset[i] = 0; | |
| 17963 |
2/4✓ Branch 0 taken 1036 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1036 times.
✗ Branch 3 not taken.
|
1036 | nx[i] = ((((i*(int32_t)x) + (dmisc5-i)*((int32_t)parent->x))) /dmisc5); |
| 17964 |
2/4✓ Branch 0 taken 1036 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1036 times.
✗ Branch 3 not taken.
|
1036 | ny[i] = ((((i*(int32_t)y) + (dmisc5-i)*((int32_t)parent->y))) /dmisc5); |
| 17965 | 1036 | } | |
| 17966 | |||
| 17967 | 259 | necktile=0; | |
| 17968 | //TODO compatibility? -DD | ||
| 17969 | /* | ||
| 17970 | for(int32_t i=0; i<4; i++) | ||
| 17971 | { | ||
| 17972 | nx[i]=124; | ||
| 17973 | ny[i]=i*6+48; | ||
| 17974 | }*/ | ||
| 17975 | 259 | bgsfx=-1; | |
| 17976 | //no need for deadsfx | ||
| 17977 | 259 | } | |
| 17978 | |||
| 17979 | 197318 | bool esGleeok::animate(int32_t index) | |
| 17980 | { | ||
| 17981 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 197318 times.
|
197318 | if(switch_hooked) return enemy::animate(index); |
| 17982 | // don't call removearmos() - it's a segment. | ||
| 17983 | |||
| 17984 | 197318 | dmisc5=vbound(dmisc5,1,255); | |
| 17985 | |||
| 17986 |
2/2✓ Branch 0 taken 44646 times.
✓ Branch 1 taken 152672 times.
|
197318 | if(misc == 0) |
| 17987 | { | ||
| 17988 | 152672 | x = (xoffset+parent->x); | |
| 17989 | 152672 | y = (yoffset+parent->y); | |
| 17990 | |||
| 17991 |
2/2✓ Branch 0 taken 610688 times.
✓ Branch 1 taken 152672 times.
|
763360 | for(int32_t i=0; i<dmisc5; i++) |
| 17992 | { | ||
| 17993 | 610688 | nx[i] = ((((i*(int32_t)x) + (dmisc5-i)*((int32_t)parent->x))) /dmisc5) + 3 + nxoffset[i]; | |
| 17994 | 610688 | ny[i] = ((((i*(int32_t)y) + (dmisc5-i)*((int32_t)parent->y))) /dmisc5) + nyoffset[i]; | |
| 17995 | 610688 | } | |
| 17996 | 152672 | } | |
| 17997 | |||
| 17998 | // set up the head tiles | ||
| 17999 | // headtile=nets+5588; //5580, actually. must adjust for direction later on | ||
| 18000 | /* | ||
| 18001 | if (dummy_bool[0]) //if this is a flame gleeok | ||
| 18002 | { | ||
| 18003 | headtile+=180; | ||
| 18004 | } | ||
| 18005 | */ | ||
| 18006 | 197318 | headtile=dummy_int[2]; //5580, actually. must adjust for direction later on | |
| 18007 | 197318 | flyingheadtile=dummy_int[3]; | |
| 18008 | |||
| 18009 | // set up the neck tiles | ||
| 18010 | 197318 | necktile=dummy_int[1]; | |
| 18011 | |||
| 18012 |
2/2✓ Branch 0 taken 122856 times.
✓ Branch 1 taken 74462 times.
|
197318 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18013 | { | ||
| 18014 | 122856 | necktile+=((clk&24)>>3); | |
| 18015 | 122856 | } | |
| 18016 | |||
| 18017 | /* | ||
| 18018 | else | ||
| 18019 | { | ||
| 18020 | necktile=145; | ||
| 18021 | } | ||
| 18022 | */ | ||
| 18023 | // ?((dummy_bool[0])?(nets+4052+(16+((clk&24)>>3))):(nets+4040+(8+((clk&24)>>3)))):145) | ||
| 18024 | |||
| 18025 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 152672 times.
✓ Branch 2 taken 44323 times.
✓ Branch 3 taken 131 times.
✓ Branch 4 taken 192 times.
|
197318 | switch(misc) |
| 18026 | { | ||
| 18027 | case 0: // live head | ||
| 18028 | // set up the attached head tiles | ||
| 18029 | 152672 | tile=headtile; | |
| 18030 | |||
| 18031 |
2/2✓ Branch 0 taken 98694 times.
✓ Branch 1 taken 53978 times.
|
152672 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18032 | { | ||
| 18033 | 98694 | tile+=((clk&24)>>3); | |
| 18034 | /* | ||
| 18035 | if (dummy_bool[0]) { | ||
| 18036 | tile+=1561; | ||
| 18037 | } | ||
| 18038 | */ | ||
| 18039 | 98694 | } | |
| 18040 | |||
| 18041 | /* | ||
| 18042 | else | ||
| 18043 | { | ||
| 18044 | tile=146; | ||
| 18045 | } | ||
| 18046 | */ | ||
| 18047 |
4/4✓ Branch 0 taken 38924 times.
✓ Branch 1 taken 113748 times.
✓ Branch 2 taken 4336 times.
✓ Branch 3 taken 34588 times.
|
152672 | if(++clk2>=0 && !(clk2&3)) |
| 18048 | { | ||
| 18049 |
2/2✓ Branch 0 taken 33832 times.
✓ Branch 1 taken 756 times.
|
34588 | if(y<= (int32_t)parent->y + 8) dir=down; |
| 18050 | |||
| 18051 |
2/2✓ Branch 0 taken 33871 times.
✓ Branch 1 taken 717 times.
|
34588 | if(y>= (int32_t)parent->y + dmisc5*8) dir = up; |
| 18052 | |||
| 18053 |
4/4✓ Branch 0 taken 3607 times.
✓ Branch 1 taken 30981 times.
✓ Branch 2 taken 3510 times.
✓ Branch 3 taken 97 times.
|
34588 | if(y<= (int32_t)parent->y + 10 && !(zc_oldrand()&31)) |
| 18054 | { | ||
| 18055 | 97 | dir^=1; | |
| 18056 | 97 | } | |
| 18057 | |||
| 18058 | 34588 | zfix tempx = x; | |
| 18059 | 34588 | zfix tempy = y; | |
| 18060 | |||
| 18061 | 34588 | sprite::move(step); | |
| 18062 | 34588 | xoffset += (x-tempx); | |
| 18063 | 34588 | yoffset += (y-tempy); | |
| 18064 | |||
| 18065 |
2/2✓ Branch 0 taken 1441 times.
✓ Branch 1 taken 33147 times.
|
34588 | if(clk2>=4) |
| 18066 | { | ||
| 18067 | 1441 | clk3^=1; | |
| 18068 | 1441 | clk2=-4; | |
| 18069 | 1441 | } | |
| 18070 | else | ||
| 18071 | { | ||
| 18072 |
2/2✓ Branch 0 taken 32808 times.
✓ Branch 1 taken 339 times.
|
33147 | if(x <= (int32_t)parent->x-(dmisc5*6)) |
| 18073 | { | ||
| 18074 | 339 | clk3=right; | |
| 18075 | 339 | } | |
| 18076 | |||
| 18077 |
2/2✓ Branch 0 taken 32776 times.
✓ Branch 1 taken 371 times.
|
33147 | if(x >= (int32_t)parent->x+(dmisc5*6)) |
| 18078 | { | ||
| 18079 | 371 | clk3=left; | |
| 18080 | 371 | } | |
| 18081 | |||
| 18082 |
4/4✓ Branch 0 taken 22330 times.
✓ Branch 1 taken 10817 times.
✓ Branch 2 taken 20970 times.
✓ Branch 3 taken 1360 times.
|
33147 | if(y <= (int32_t)parent->y+(dmisc5*6) && !(zc_oldrand()&15)) |
| 18083 | { | ||
| 18084 | 1360 | clk3^=1; // x jig | |
| 18085 | 1360 | } | |
| 18086 | else | ||
| 18087 | { | ||
| 18088 |
4/4✓ Branch 0 taken 10913 times.
✓ Branch 1 taken 20874 times.
✓ Branch 2 taken 10584 times.
✓ Branch 3 taken 329 times.
|
31787 | if(y<=(int32_t)parent->y+(dmisc5*4) && !(zc_oldrand()&31)) |
| 18089 | { | ||
| 18090 | 329 | clk3^=1; // x switch back | |
| 18091 | 329 | } | |
| 18092 | |||
| 18093 | 31787 | clk2=-4; | |
| 18094 | } | ||
| 18095 | } | ||
| 18096 | |||
| 18097 | 34588 | zc_swap(dir,clk3); | |
| 18098 | 34588 | tempx = x; | |
| 18099 | 34588 | tempy = y; | |
| 18100 | 34588 | sprite::move(step); | |
| 18101 | 34588 | xoffset += (x-tempx); | |
| 18102 | 34588 | yoffset += (y-tempy); | |
| 18103 | 34588 | zc_swap(dir,clk3); | |
| 18104 | |||
| 18105 |
2/2✓ Branch 0 taken 103764 times.
✓ Branch 1 taken 34588 times.
|
138352 | for(int32_t i=1; i<dmisc5; i++) |
| 18106 | { | ||
| 18107 | 103764 | nxoffset[i] = (zc_oldrand()%3); | |
| 18108 | 103764 | nyoffset[i] = (zc_oldrand()%3); | |
| 18109 | 103764 | } | |
| 18110 | 34588 | } | |
| 18111 | |||
| 18112 | 152672 | break; | |
| 18113 | |||
| 18114 | case 1: // flying head | ||
| 18115 |
2/2✓ Branch 0 taken 2737 times.
✓ Branch 1 taken 41586 times.
|
44323 | if(clk>=0) |
| 18116 | |||
| 18117 | { | ||
| 18118 | 41586 | variable_walk_8(rate,homing,hrate,spw_floater); | |
| 18119 | 41586 | } | |
| 18120 | |||
| 18121 | 44323 | break; | |
| 18122 | |||
| 18123 | // the following are messages sent from the main guy... | ||
| 18124 | case -1: // got chopped off | ||
| 18125 | { | ||
| 18126 | 131 | misc=1; | |
| 18127 | 131 | superman=1; | |
| 18128 | 131 | hxofs=xofs=0; | |
| 18129 | 131 | hxsz=16; | |
| 18130 | 131 | cs=8; | |
| 18131 | 131 | clk=-24; | |
| 18132 | 131 | clk2=40; | |
| 18133 | 131 | dir=(zc_oldrand()&7)+8; | |
| 18134 | 131 | step=8.0/9.0; | |
| 18135 | } | ||
| 18136 | 131 | break; | |
| 18137 | |||
| 18138 | case -2: // the big guy is dead | ||
| 18139 | 192 | return true; | |
| 18140 | } | ||
| 18141 | |||
| 18142 |
2/2✓ Branch 0 taken 184800 times.
✓ Branch 1 taken 12326 times.
|
197126 | if(timer) |
| 18143 | { | ||
| 18144 |
2/2✓ Branch 0 taken 10857 times.
✓ Branch 1 taken 1469 times.
|
12326 | if(!(timer%8)) |
| 18145 | { | ||
| 18146 | 1469 | FireBreath(true); | |
| 18147 | 1469 | } | |
| 18148 | |||
| 18149 | 12326 | --timer; | |
| 18150 | 12326 | } | |
| 18151 | |||
| 18152 | 197126 | return enemy::animate(index); | |
| 18153 | 197318 | } | |
| 18154 | |||
| 18155 | 3299 | int32_t esGleeok::takehit(weapon *w, weapon* realweap) | |
| 18156 | { | ||
| 18157 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3299 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3299 | if ((editorflags & ENEMY_FLAG7) && misc == 1) |
| 18158 | { | ||
| 18159 | ✗ | int32_t wpnId = w->id; | |
| 18160 | |||
| 18161 | ✗ | if(dying) | |
| 18162 | ✗ | return 0; | |
| 18163 | |||
| 18164 | ✗ | switch(wpnId) | |
| 18165 | { | ||
| 18166 | case wLitBomb: | ||
| 18167 | case wLitSBomb: | ||
| 18168 | case wBait: | ||
| 18169 | case wWhistle: | ||
| 18170 | case wFire: | ||
| 18171 | case wWind: | ||
| 18172 | case wSSparkle: | ||
| 18173 | case wFSparkle: | ||
| 18174 | case wPhantom: | ||
| 18175 | ✗ | return 0; | |
| 18176 | |||
| 18177 | case wHookshot: | ||
| 18178 | case wBrang: | ||
| 18179 | case wBeam: | ||
| 18180 | case wArrow: | ||
| 18181 | case wMagic: | ||
| 18182 | case wBomb: | ||
| 18183 | case wSBomb: | ||
| 18184 | ✗ | sfx(WAV_CHINK,pan(int32_t(x))); | |
| 18185 | ✗ | break; | |
| 18186 | default: | ||
| 18187 | ✗ | break; | |
| 18188 | } | ||
| 18189 | |||
| 18190 | ✗ | return 1; | |
| 18191 | } | ||
| 18192 | else | ||
| 18193 | { | ||
| 18194 | 3299 | int32_t ret = enemy::takehit(w,realweap); | |
| 18195 | |||
| 18196 |
2/2✓ Branch 0 taken 636 times.
✓ Branch 1 taken 2663 times.
|
3299 | if(ret==-1) |
| 18197 | 2663 | return 2; // force it to wait a frame before checking sword attacks again | |
| 18198 | |||
| 18199 | 636 | return ret; | |
| 18200 | } | ||
| 18201 | 3299 | } | |
| 18202 | |||
| 18203 | 198003 | void esGleeok::draw(BITMAP *dest) | |
| 18204 | { | ||
| 18205 | 198003 | dmisc5=vbound(dmisc5,1,255); | |
| 18206 | |||
| 18207 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 153561 times.
✓ Branch 2 taken 44442 times.
|
198003 | switch(misc) |
| 18208 | { | ||
| 18209 | case 0: //neck | ||
| 18210 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 153561 times.
|
153561 | if(!dont_draw()) |
| 18211 | { | ||
| 18212 |
2/2✓ Branch 0 taken 460683 times.
✓ Branch 1 taken 153561 times.
|
614244 | for(int32_t i=1; i<dmisc5; i++) //draw the neck |
| 18213 | { | ||
| 18214 |
2/2✓ Branch 0 taken 298542 times.
✓ Branch 1 taken 162141 times.
|
460683 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18215 | { | ||
| 18216 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 298542 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
298542 | if((tmpscr->flags3&fINVISROOM)&& !(current_item(itype_amulet))) |
| 18217 | ✗ | overtilecloaked16(dest,necktile+(i*dmisc7),nx[i]-4,ny[i]+playing_field_offset,0); | |
| 18218 | else | ||
| 18219 | 298542 | overtile16(dest,necktile+(i*dmisc7),nx[i]-4,ny[i]+playing_field_offset,cs,0); | |
| 18220 | 298542 | } | |
| 18221 | else | ||
| 18222 | { | ||
| 18223 |
3/4✓ Branch 0 taken 4278 times.
✓ Branch 1 taken 157863 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4278 times.
|
162141 | if((tmpscr->flags3&fINVISROOM)&& !(current_item(itype_amulet))) |
| 18224 | ✗ | overtilecloaked16(dest,necktile,nx[i]-4,ny[i]+playing_field_offset,0); | |
| 18225 | else | ||
| 18226 | 162141 | overtile16(dest,necktile,nx[i]-4,ny[i]+playing_field_offset,cs,0); | |
| 18227 | } | ||
| 18228 | 460683 | } | |
| 18229 | 153561 | } | |
| 18230 | |||
| 18231 | 153561 | break; | |
| 18232 | |||
| 18233 | case 1: //flying head | ||
| 18234 | 44442 | tile=flyingheadtile; | |
| 18235 | |||
| 18236 |
2/2✓ Branch 0 taken 20413 times.
✓ Branch 1 taken 24029 times.
|
44442 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18237 | { | ||
| 18238 | 24029 | tile+=((clk&24)>>3); | |
| 18239 | 24029 | break; | |
| 18240 | } | ||
| 18241 | |||
| 18242 | /* | ||
| 18243 | else | ||
| 18244 | { | ||
| 18245 | tile=(clk&1)?147:148; | ||
| 18246 | break; | ||
| 18247 | } | ||
| 18248 | */ | ||
| 18249 | 20413 | } | |
| 18250 | 198003 | } | |
| 18251 | |||
| 18252 | 198003 | void esGleeok::draw2(BITMAP *dest) | |
| 18253 | { | ||
| 18254 | 198003 | enemy::draw(dest); | |
| 18255 | 198003 | } | |
| 18256 | |||
| 18257 | 104 | ePatra::ePatra(zfix X,zfix Y,int32_t Id,int32_t Clk) : enemy(X,Y,Id,Clk)// enemy((zfix)128,(zfix)48,Id,Clk) | |
| 18258 | 104 | { | |
| 18259 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | if ( !(editorflags & ENEMY_FLAG5) ) |
| 18260 | { | ||
| 18261 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | x = 128; |
| 18262 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | y = 48; |
| 18263 | 52 | } | |
| 18264 | ✗ | else { x = X; y = Y; } | |
| 18265 | 52 | adjusted=false; | |
| 18266 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | dir=(zc_oldrand()&7)+8; |
| 18267 | //step=0.25; | ||
| 18268 | 52 | flycnt=dmisc1; | |
| 18269 | 52 | flycnt2=dmisc2; | |
| 18270 | 52 | loopcnt=0; | |
| 18271 | 52 | clk4 = 0; | |
| 18272 | 52 | clk5 = 0; | |
| 18273 | 52 | clk6 = 0; | |
| 18274 | 52 | clk7 = 0; | |
| 18275 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | if(dmisc6<int16_t(1))dmisc6=1; // ratio cannot be 0! |
| 18276 | 52 | SIZEflags = d->SIZEflags; | |
| 18277 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 18278 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | else if (dmisc10 == 1) { txsz = 2; extend = 3; } |
| 18279 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 18280 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 18281 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = tysz; if ( tysz > 1 ) extend = 3; } |
| 18282 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | else if (dmisc10 == 1) { tysz = 2; extend = 3; } |
| 18283 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = hxsz; |
| 18284 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | else if (dmisc10 == 1) hxsz = 32; |
| 18285 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = hysz; |
| 18286 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = hzsz; |
| 18287 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = hxofs; |
| 18288 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | else if (dmisc10 == 1) hxofs = -8; |
| 18289 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = hyofs; |
| 18290 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 18291 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)xofs; |
| 18292 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
52 | else if (dmisc10 == 1) xofs = -8; |
| 18293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 18294 | { | ||
| 18295 | ✗ | yofs = (int32_t)yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 18296 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 18297 | ✗ | } | |
| 18298 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
52 | else if (dmisc10 == 1) yofs = (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset)-8; |
| 18299 |
1/2✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
|
52 | if (editorflags & ENEMY_FLAG8) misc = 1; |
| 18300 | |||
| 18301 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
52 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)zofs; |
| 18302 | |||
| 18303 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if (dmisc29 == 0) |
| 18304 | { | ||
| 18305 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 33 times.
|
52 | if(!dmisc4) |
| 18306 | { | ||
| 18307 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if (dmisc10) dmisc29 = (90 / 3); |
| 18308 | 33 | else dmisc29 = (84 / 3); | |
| 18309 | 33 | } | |
| 18310 | else | ||
| 18311 | { | ||
| 18312 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | if (dmisc10) dmisc29 = (90 / 2); |
| 18313 | 19 | else dmisc29 = (84 / 2); | |
| 18314 | } | ||
| 18315 | 52 | } | |
| 18316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if (dmisc30 == 0) |
| 18317 | { | ||
| 18318 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 33 times.
|
52 | if(!dmisc4) |
| 18319 | { | ||
| 18320 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if (dmisc10) dmisc30 = (90 / 3)*0.5; |
| 18321 | 33 | else dmisc30 = (84 / 3)*0.5; | |
| 18322 | 33 | } | |
| 18323 | else | ||
| 18324 | { | ||
| 18325 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | if (dmisc10) dmisc30 = (90 / 2)*0.5; |
| 18326 | 19 | else dmisc30 = (84 / 2)*0.5; | |
| 18327 | } | ||
| 18328 | 52 | } | |
| 18329 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if (dmisc31 == 0) |
| 18330 | { | ||
| 18331 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 33 times.
|
52 | if(!dmisc4) |
| 18332 | { | ||
| 18333 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if (dmisc10) dmisc31 = (90 / 3)*2; |
| 18334 | 33 | else dmisc31 = (84 / 3)*2; | |
| 18335 | 33 | } | |
| 18336 | else | ||
| 18337 | { | ||
| 18338 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | if (dmisc10) dmisc31 = (90 / 2)*0.5; |
| 18339 | 19 | else dmisc31 = (84 / 2)*0.5; | |
| 18340 | } | ||
| 18341 | 52 | } | |
| 18342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
|
52 | if (dmisc32 == 0) |
| 18343 | { | ||
| 18344 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 33 times.
|
52 | if(!dmisc4) |
| 18345 | { | ||
| 18346 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
|
33 | if (dmisc10) dmisc32 = (90 / 3); |
| 18347 | 33 | else dmisc32 = (84 / 3); | |
| 18348 | 33 | } | |
| 18349 | else | ||
| 18350 | { | ||
| 18351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
|
19 | if (dmisc10) dmisc32 = (90 / 2)*0.25; |
| 18352 | 19 | else dmisc32 = (84 / 2)*0.25; | |
| 18353 | } | ||
| 18354 | 52 | } | |
| 18355 | 52 | } | |
| 18356 | |||
| 18357 | 62324 | bool ePatra::animate(int32_t index) | |
| 18358 | { | ||
| 18359 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62324 times.
|
62324 | if(switch_hooked) return enemy::animate(index); |
| 18360 |
2/2✓ Branch 0 taken 792 times.
✓ Branch 1 taken 61532 times.
|
62324 | if(dying) |
| 18361 | { | ||
| 18362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 792 times.
|
792 | for(int32_t i=index+1; i<index+flycnt+flycnt2+1; i++) |
| 18363 | { | ||
| 18364 | ✗ | ((enemy*)guys.spr(i))->hp = -1000; | |
| 18365 | ✗ | } | |
| 18366 | |||
| 18367 | 792 | return Dead(index); | |
| 18368 | } | ||
| 18369 | |||
| 18370 | 61532 | double basesize = 84; | |
| 18371 |
1/2✓ Branch 0 taken 61532 times.
✗ Branch 1 not taken.
|
61532 | if (dmisc10) basesize = 90; |
| 18372 | 61532 | double halfsize = basesize / 2; | |
| 18373 | 61532 | double quartersize = halfsize / 2; | |
| 18374 | 61532 | double twothirdsize = (basesize / 3)*2; | |
| 18375 | 61532 | double onethirdsize = (basesize / 3); | |
| 18376 | |||
| 18377 | |||
| 18378 |
2/2✓ Branch 0 taken 13665 times.
✓ Branch 1 taken 47867 times.
|
61532 | if(clk==0) |
| 18379 | { | ||
| 18380 | 13665 | removearmos(x,y,ffcactivated); | |
| 18381 | 13665 | } | |
| 18382 | |||
| 18383 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 61532 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 61532 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
61532 | if ((clk4 <=0 || clk4%2) && (clk7 <= 0 || clk6 <= -16)) |
| 18384 | { | ||
| 18385 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 61532 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
61532 | if (!dmisc22 || loopcnt == 0 || (dmisc22 == 1 && loopcnt < 0)) variable_walk_8(rate,homing,hrate,spw_floater); |
| 18386 |
1/2✓ Branch 0 taken 61532 times.
✗ Branch 1 not taken.
|
61532 | if (loopcnt < 0) ++clk2; |
| 18387 |
2/2✓ Branch 0 taken 60837 times.
✓ Branch 1 taken 695 times.
|
61532 | if(++clk2>basesize) |
| 18388 | { | ||
| 18389 | 695 | clk2=0; | |
| 18390 |
2/12✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 695 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
695 | if ((!dmisc26 || (dmisc26 == 1 && flycnt) || (dmisc26 == 2 && !flycnt)) && (!(editorflags & ENEMY_FLAG10) || flycnt || flycnt2)) |
| 18391 | { | ||
| 18392 |
2/2✓ Branch 0 taken 361 times.
✓ Branch 1 taken 334 times.
|
695 | if(loopcnt > 0) |
| 18393 | 361 | --loopcnt; | |
| 18394 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 334 times.
|
334 | else if (loopcnt == 0) |
| 18395 | { | ||
| 18396 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 128 times.
|
334 | if((misc%dmisc6)==0) |
| 18397 | { | ||
| 18398 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | if (dmisc21 > 0) loopcnt=-dmisc21; |
| 18399 | 128 | else loopcnt=dmisc7; | |
| 18400 | 128 | } | |
| 18401 | 334 | } | |
| 18402 | ✗ | else if (loopcnt == -1) loopcnt=dmisc7; | |
| 18403 | ✗ | else ++loopcnt; | |
| 18404 | |||
| 18405 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 695 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
695 | if (!(editorflags & ENEMY_FLAG9) || loopcnt == 0) ++misc; |
| 18406 | 695 | } | |
| 18407 | else | ||
| 18408 | { | ||
| 18409 | ✗ | loopcnt = 0; | |
| 18410 | ✗ | misc = 1; | |
| 18411 | } | ||
| 18412 | 695 | } | |
| 18413 | 61532 | } | |
| 18414 |
1/2✓ Branch 0 taken 61532 times.
✗ Branch 1 not taken.
|
61532 | if (clk4 > 0) --clk4; |
| 18415 | |||
| 18416 | 61532 | double size=1; | |
| 18417 | |||
| 18418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61532 times.
|
61532 | if (clk6 < 0) |
| 18419 | { | ||
| 18420 | ✗ | if (dmisc5 == 1 || dmisc5 == 3) | |
| 18421 | { | ||
| 18422 | ✗ | if (get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 18423 | { | ||
| 18424 | ✗ | if (clk7 <= 0 || clk6 != -16) ++clk6; | |
| 18425 | ✗ | if (clk6 == 0) o_tile=d->e_tile; | |
| 18426 | else | ||
| 18427 | { | ||
| 18428 | ✗ | if (clk6 >= -16) o_tile=d->e_tile + (IsBigAnim() ? 320 : 80); | |
| 18429 | ✗ | else o_tile=d->e_tile + (IsBigAnim() ? 160 : 40); | |
| 18430 | } | ||
| 18431 | ✗ | } | |
| 18432 | ✗ | else clk6 = 0; | |
| 18433 | ✗ | } | |
| 18434 | ✗ | } | |
| 18435 |
1/2✓ Branch 0 taken 61532 times.
✗ Branch 1 not taken.
|
61532 | else if (dmisc19) ++clk6; |
| 18436 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61532 times.
|
61532 | if (clk5 < 0) ++clk5; |
| 18437 |
1/2✓ Branch 0 taken 61532 times.
✗ Branch 1 not taken.
|
61532 | else if (dmisc19) ++clk5; |
| 18438 | |||
| 18439 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 61532 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
61532 | if (clk7 > 0 && clk6 >= -16) --clk7; |
| 18440 |
1/2✓ Branch 0 taken 61532 times.
✗ Branch 1 not taken.
|
61532 | if (clk6 > 0) clk7 = 0; |
| 18441 | |||
| 18442 |
2/2✓ Branch 0 taken 243988 times.
✓ Branch 1 taken 61532 times.
|
305520 | for(int32_t i=index+1; i<index+flycnt+1; i++) |
| 18443 | { | ||
| 18444 | //outside ring | ||
| 18445 |
2/2✓ Branch 0 taken 243572 times.
✓ Branch 1 taken 416 times.
|
243988 | if(!adjusted) |
| 18446 | { | ||
| 18447 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 144 times.
|
416 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18448 | { | ||
| 18449 | 272 | ((enemy*)guys.spr(i))->o_tile=d->e_tile+dmisc8; | |
| 18450 | 272 | enemy *s = ((enemy*)guys.spr(i)); | |
| 18451 | 272 | s->parent_script_UID = this->script_UID; | |
| 18452 | 272 | } | |
| 18453 | else | ||
| 18454 | { | ||
| 18455 | 144 | ((enemy*)guys.spr(i))->o_tile=o_tile+1; | |
| 18456 | 144 | enemy *s = ((enemy*)guys.spr(i)); | |
| 18457 | 144 | s->parent_script_UID = this->script_UID; | |
| 18458 | } | ||
| 18459 | |||
| 18460 | 416 | ((enemy*)guys.spr(i))->cs=dmisc9; | |
| 18461 | 416 | ((enemy*)guys.spr(i))->hp=dmisc3; | |
| 18462 | 416 | } | |
| 18463 | |||
| 18464 |
2/2✓ Branch 0 taken 357 times.
✓ Branch 1 taken 243631 times.
|
243988 | if(((enemy*)guys.spr(i))->hp <= 0) |
| 18465 | { | ||
| 18466 |
2/2✓ Branch 0 taken 1278 times.
✓ Branch 1 taken 357 times.
|
1635 | for(int32_t j=i; j<index+flycnt+flycnt2; j++) |
| 18467 | { | ||
| 18468 | 1278 | guys.swap(j,j+1); | |
| 18469 | 1278 | } | |
| 18470 | |||
| 18471 |
3/4✓ Branch 0 taken 44 times.
✓ Branch 1 taken 313 times.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
|
357 | if (--flycnt == 0 && dmisc23 != 0) step += zslongToFix(dmisc23*100); |
| 18472 | 357 | } | |
| 18473 | else | ||
| 18474 | { | ||
| 18475 | 243631 | int32_t pos2 = ((enemy*)guys.spr(i))->misc; | |
| 18476 |
1/2✓ Branch 0 taken 243631 times.
✗ Branch 1 not taken.
|
243631 | double a2 = (clk2-pos2*(double)basesize/(dmisc1 == 0 ? 1 : dmisc1))*PI/halfsize; |
| 18477 | |||
| 18478 |
2/2✓ Branch 0 taken 86815 times.
✓ Branch 1 taken 156816 times.
|
243631 | if(!dmisc4) //Big Ring |
| 18479 | { | ||
| 18480 | //maybe playing_field_offset here? | ||
| 18481 |
2/2✓ Branch 0 taken 71944 times.
✓ Branch 1 taken 84872 times.
|
156816 | if(loopcnt>0) |
| 18482 | { | ||
| 18483 |
1/2✓ Branch 0 taken 84872 times.
✗ Branch 1 not taken.
|
84872 | guys.spr(i)->x = zc::math::Cos(a2+PI/2)*abs(dmisc31) - zc::math::Sin(pos2*PI*2/(dmisc1 == 0 ? 1 : dmisc1))*((int64_t)abs(dmisc31)-abs(dmisc29)); |
| 18484 |
1/2✓ Branch 0 taken 84872 times.
✗ Branch 1 not taken.
|
84872 | guys.spr(i)->y = -zc::math::Sin(a2+PI/2)*abs(dmisc31) + zc::math::Cos(pos2*PI*2/(dmisc1 == 0 ? 1 : dmisc1))*((int64_t)abs(dmisc31)-abs(dmisc29)); |
| 18485 | 84872 | } | |
| 18486 | else | ||
| 18487 | { | ||
| 18488 | 71944 | guys.spr(i)->x = zc::math::Cos(a2+PI/2)*abs(dmisc29); | |
| 18489 | 71944 | guys.spr(i)->y = -zc::math::Sin(a2+PI/2)*abs(dmisc29); | |
| 18490 | } | ||
| 18491 | |||
| 18492 | 156816 | temp_x=guys.spr(i)->x; | |
| 18493 | 156816 | temp_y=guys.spr(i)->y; | |
| 18494 | 156816 | } | |
| 18495 | else //Oval | ||
| 18496 | { | ||
| 18497 | 86815 | circle_x = zc::math::Cos(a2+PI/2)*abs(dmisc29); | |
| 18498 | 86815 | circle_y = -zc::math::Sin(a2+PI/2)*abs(dmisc29); | |
| 18499 | |||
| 18500 |
2/2✓ Branch 0 taken 50142 times.
✓ Branch 1 taken 36673 times.
|
86815 | if(loopcnt>0) |
| 18501 | { | ||
| 18502 | 50142 | guys.spr(i)->x = zc::math::Cos(a2+PI/2)*abs(dmisc29); | |
| 18503 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50142 times.
|
50142 | guys.spr(i)->y = (-zc::math::Sin(a2+PI/2)-zc::math::Cos(pos2*PI*2/(dmisc1 == 0 ? 1 : dmisc1)))*abs(dmisc31); |
| 18504 | 50142 | } | |
| 18505 | else | ||
| 18506 | { | ||
| 18507 | 36673 | guys.spr(i)->x = circle_x; | |
| 18508 | 36673 | guys.spr(i)->y = circle_y; | |
| 18509 | } | ||
| 18510 | |||
| 18511 | 86815 | temp_x=circle_x; | |
| 18512 | 86815 | temp_y=circle_y; | |
| 18513 | } | ||
| 18514 | |||
| 18515 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 18516 | 243631 | double ddir=atan2_MSVC2022_FIX(double(temp_y),double(temp_x)); | |
| 18517 | |||
| 18518 |
4/4✓ Branch 0 taken 46188 times.
✓ Branch 1 taken 197443 times.
✓ Branch 2 taken 15268 times.
✓ Branch 3 taken 30920 times.
|
243631 | if((ddir<=(((-5)*PI)/8))&&(ddir>(((-7)*PI)/8))) |
| 18519 | { | ||
| 18520 | 30920 | guys.spr(i)->dir=l_down; | |
| 18521 | 30920 | } | |
| 18522 |
4/4✓ Branch 0 taken 46236 times.
✓ Branch 1 taken 166475 times.
✓ Branch 2 taken 15268 times.
✓ Branch 3 taken 30968 times.
|
212711 | else if((ddir<=(((-3)*PI)/8))&&(ddir>(((-5)*PI)/8))) |
| 18523 | { | ||
| 18524 | 30968 | guys.spr(i)->dir=left; | |
| 18525 | 30968 | } | |
| 18526 |
4/4✓ Branch 0 taken 45970 times.
✓ Branch 1 taken 135773 times.
✓ Branch 2 taken 15268 times.
✓ Branch 3 taken 30702 times.
|
181743 | else if((ddir<=(((-1)*PI)/8))&&(ddir>(((-3)*PI)/8))) |
| 18527 | { | ||
| 18528 | 30702 | guys.spr(i)->dir=l_up; | |
| 18529 | 30702 | } | |
| 18530 |
4/4✓ Branch 0 taken 45616 times.
✓ Branch 1 taken 105425 times.
✓ Branch 2 taken 15268 times.
✓ Branch 3 taken 30348 times.
|
151041 | else if((ddir<=(((1)*PI)/8))&&(ddir>(((-1)*PI)/8))) |
| 18531 | { | ||
| 18532 | 30348 | guys.spr(i)->dir=up; | |
| 18533 | 30348 | } | |
| 18534 |
4/4✓ Branch 0 taken 45391 times.
✓ Branch 1 taken 75302 times.
✓ Branch 2 taken 15268 times.
✓ Branch 3 taken 30123 times.
|
120693 | else if((ddir<=(((3)*PI)/8))&&(ddir>(((1)*PI)/8))) |
| 18535 | { | ||
| 18536 | 30123 | guys.spr(i)->dir=r_up; | |
| 18537 | 30123 | } | |
| 18538 |
4/4✓ Branch 0 taken 45243 times.
✓ Branch 1 taken 45327 times.
✓ Branch 2 taken 15268 times.
✓ Branch 3 taken 29975 times.
|
90570 | else if((ddir<=(((5)*PI)/8))&&(ddir>(((3)*PI)/8))) |
| 18539 | { | ||
| 18540 | 29975 | guys.spr(i)->dir=right; | |
| 18541 | 29975 | } | |
| 18542 |
4/4✓ Branch 0 taken 45326 times.
✓ Branch 1 taken 15269 times.
✓ Branch 2 taken 15268 times.
✓ Branch 3 taken 30058 times.
|
60595 | else if((ddir<=(((7)*PI)/8))&&(ddir>(((5)*PI)/8))) |
| 18543 | { | ||
| 18544 | 30058 | guys.spr(i)->dir=r_down; | |
| 18545 | 30058 | } | |
| 18546 | else | ||
| 18547 | { | ||
| 18548 | 30537 | guys.spr(i)->dir=down; | |
| 18549 | } | ||
| 18550 | |||
| 18551 | 243631 | guys.spr(i)->x += x; | |
| 18552 | 243631 | guys.spr(i)->y += y; | |
| 18553 | } | ||
| 18554 | 243988 | } | |
| 18555 | |||
| 18556 |
7/22✓ Branch 0 taken 39916 times.
✓ Branch 1 taken 21616 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39916 times.
✓ Branch 4 taken 5813 times.
✓ Branch 5 taken 15803 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5813 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 15803 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
61532 | if((wpn>wEnemyWeapons || (wpn >= wScript1 && wpn <= wScript10)) && (dmisc5==1 || dmisc5== 3) && (!dmisc25 || (dmisc25 == 1 && !flycnt && !flycnt2) || (dmisc25 == 2 && (flycnt || flycnt2)) || (dmisc25 == 3 && flycnt2 && !flycnt))) |
| 18557 | { | ||
| 18558 | 15803 | int timeneeded = 48; | |
| 18559 | 15803 | int patbreath = (zc_oldrand()%50+50); | |
| 18560 |
2/2✓ Branch 0 taken 11961 times.
✓ Branch 1 taken 3842 times.
|
15803 | if ((patbreath % 4) == 0) ++patbreath; |
| 18561 |
1/2✓ Branch 0 taken 15803 times.
✗ Branch 1 not taken.
|
15803 | if (dmisc28 == patratBREATH) |
| 18562 | { | ||
| 18563 | ✗ | timeneeded = 48 + patbreath; | |
| 18564 | ✗ | } | |
| 18565 |
1/2✓ Branch 0 taken 15803 times.
✗ Branch 1 not taken.
|
15803 | if (dmisc28 == patratSTREAM) |
| 18566 | { | ||
| 18567 | ✗ | timeneeded = 48 + 96; | |
| 18568 | ✗ | } | |
| 18569 |
4/14✓ Branch 0 taken 15803 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15803 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 133 times.
✓ Branch 11 taken 133 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
15803 | if (((((dmisc18 > 0 || ((editorflags & ENEMY_FLAG10) && !flycnt && !flycnt2)) && !(zc_oldrand() % zc_max(dmisc18, 1))) || //New 1/N chance |
| 18570 |
2/2✓ Branch 0 taken 15803 times.
✓ Branch 1 taken 133 times.
|
15936 | (dmisc18 == 0 && !(zc_oldrand()&127)) //Old hardcoded firing chance |
| 18571 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 15670 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
15936 | || (dmisc18 == -1 && loopcnt > 0 && (clk2 == round(halfsize) && (!(editorflags & ENEMY_FLAG3) || !get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18572 | ✗ | || (clk4 == 10 && (editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES))))) | |
| 18573 | 133 | && (clk6 >= 0) //if not in the middle of firing... | |
| 18574 | 133 | && clk6 >= dmisc19) //if over the set cooldown between shots... | |
| 18575 |
2/6✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 133 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
133 | && ((!(editorflags & ENEMY_FLAG7) || (loopcnt == 0 && (basesize*((int64_t)dmisc6 - (misc%dmisc6))) > timeneeded)) || dmisc18 == -1)) //And lastly, if not in danger of starting a loop during the attack. |
| 18576 | { | ||
| 18577 |
1/3✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
133 | switch(dmisc28) |
| 18578 | { | ||
| 18579 | case patratSTREAM: | ||
| 18580 | { | ||
| 18581 | ✗ | clk7 = 97; | |
| 18582 | ✗ | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES)) clk6 = -48; | |
| 18583 | ✗ | else clk6 = 0; | |
| 18584 | ✗ | break; | |
| 18585 | } | ||
| 18586 | case patratBREATH: | ||
| 18587 | { | ||
| 18588 | ✗ | clk7 = patbreath; | |
| 18589 | ✗ | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES)) clk6 = -48; | |
| 18590 | ✗ | else clk6 = 0; | |
| 18591 | ✗ | break; | |
| 18592 | } | ||
| 18593 | default: | ||
| 18594 | { | ||
| 18595 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 133 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
133 | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18596 | { | ||
| 18597 | ✗ | clk6 = -48; | |
| 18598 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = abs(clk6) + 16; | |
| 18599 | ✗ | } | |
| 18600 | else | ||
| 18601 | { | ||
| 18602 | 133 | clk6 = 0; | |
| 18603 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | if (editorflags & ENEMY_FLAG6) clk4 = 16; |
| 18604 | 133 | FirePatraWeapon(); | |
| 18605 | } | ||
| 18606 | 133 | break; | |
| 18607 | } | ||
| 18608 | } //ew->setAngle(atan2(double(HeroY()-y),double(HeroX()-x))); | ||
| 18609 | 133 | } | |
| 18610 |
1/2✓ Branch 0 taken 15803 times.
✗ Branch 1 not taken.
|
15803 | if (clk6 < 0) |
| 18611 | { | ||
| 18612 | ✗ | switch(dmisc28) | |
| 18613 | { | ||
| 18614 | case patratSTREAM: | ||
| 18615 | { | ||
| 18616 | ✗ | if (clk7 > 0 && (clk7 % 12) == 0) FirePatraWeapon(); | |
| 18617 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = abs(clk6) + 16; | |
| 18618 | ✗ | break; | |
| 18619 | } | ||
| 18620 | case patratBREATH: | ||
| 18621 | { | ||
| 18622 | ✗ | if (clk7 > 0 && (clk7 % 4) == 0) FirePatraWeapon(); | |
| 18623 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = abs(clk6) + 16; | |
| 18624 | ✗ | break; | |
| 18625 | } | ||
| 18626 | default: | ||
| 18627 | { | ||
| 18628 | ✗ | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES) && clk6 == -16) | |
| 18629 | { | ||
| 18630 | ✗ | FirePatraWeapon(); | |
| 18631 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = abs(clk6) + 16; | |
| 18632 | ✗ | } | |
| 18633 | ✗ | break; | |
| 18634 | } | ||
| 18635 | } | ||
| 18636 | ✗ | } | |
| 18637 | 15803 | } | |
| 18638 | |||
| 18639 | 61532 | size=.5; | |
| 18640 | 61532 | int randattempts = 0; | |
| 18641 | 61532 | int randeye = 0; | |
| 18642 |
2/2✓ Branch 0 taken 44930 times.
✓ Branch 1 taken 16602 times.
|
61532 | if (flycnt2 > 0) |
| 18643 | { | ||
| 18644 | 16602 | do | |
| 18645 | { | ||
| 18646 |
2/4✓ Branch 0 taken 16602 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16602 times.
|
16602 | randeye = ((flycnt2 > 0) ? (zc_oldrand() % zc_max(1, flycnt2)) : 0); |
| 18647 | 16602 | randeye += (index + flycnt + 1); | |
| 18648 | 16602 | ++randattempts; | |
| 18649 |
2/4✓ Branch 0 taken 16602 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16602 times.
|
16602 | } while (((esPatra*)guys.spr(randeye))->clk5 < 0 && randattempts < 10); |
| 18650 | 16602 | } | |
| 18651 | 61532 | bool dofire = false; | |
| 18652 |
1/2✓ Branch 0 taken 61532 times.
✗ Branch 1 not taken.
|
61532 | if (dmisc20) |
| 18653 | { | ||
| 18654 | ✗ | if ((dmisc18 > 0 && !(zc_oldrand() % zc_max(dmisc18, 1))) || | |
| 18655 | ✗ | (dmisc18 == 0 && !(zc_oldrand()&127)) || | |
| 18656 | ✗ | (dmisc18 == -1 && (loopcnt > 0 || dmisc20 == 4) && ((clk2 == round(halfsize) && (!(editorflags & ENEMY_FLAG3) || !get_bit(quest_rules,qr_NEWENEMYTILES)) && dmisc20 != 2 && dmisc20 != 4) | |
| 18657 | ✗ | || (clk2 == 10 && dmisc20 != 4 && ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES) || dmisc20 == 2)) | |
| 18658 | ✗ | || ((((((misc%dmisc6) == 0 && (loopcnt == 0 && !dmisc21)) || loopcnt > 1 || loopcnt == -1) && clk2 <= 53 && clk2 >= 51 && (editorflags & ENEMY_FLAG3)) || (!(editorflags & ENEMY_FLAG3) && loopcnt > 0 && clk2 == 1)) && dmisc20 == 4)))) | |
| 18659 | { | ||
| 18660 | ✗ | if (clk5 >= 0 || !(editorflags & ENEMY_FLAG3) || !get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 18661 | { | ||
| 18662 | ✗ | if (clk5 >= dmisc19) | |
| 18663 | { | ||
| 18664 | ✗ | if ((!(editorflags & ENEMY_FLAG7) || (loopcnt == 0 && | |
| 18665 | ✗ | (dmisc20 == 2 && (basesize*((int64_t)dmisc6 - (misc%dmisc6))) > ((int64_t)48 + (int64_t(12)*flycnt2))) || | |
| 18666 | ✗ | (dmisc20 == 4 && (basesize*((int64_t)dmisc6 - (misc%dmisc6))) > ((int64_t)48 + 96)) || | |
| 18667 | ✗ | (dmisc20 != 2 && dmisc20 != 4 && (basesize*((int64_t)dmisc6 - (misc%dmisc6))) > 48))) | |
| 18668 | ✗ | || dmisc18 == -1) | |
| 18669 | ✗ | dofire = true; | |
| 18670 | ✗ | } | |
| 18671 | ✗ | } | |
| 18672 | ✗ | } | |
| 18673 | ✗ | } | |
| 18674 |
2/2✓ Branch 0 taken 44930 times.
✓ Branch 1 taken 16602 times.
|
61532 | if(flycnt2) |
| 18675 | { | ||
| 18676 |
2/2✓ Branch 0 taken 119975 times.
✓ Branch 1 taken 16602 times.
|
136577 | for(int32_t i=index+flycnt+1; i<index+flycnt+flycnt2+1; i++)//inner ring |
| 18677 | { | ||
| 18678 |
2/2✓ Branch 0 taken 119887 times.
✓ Branch 1 taken 88 times.
|
119975 | if(!adjusted) |
| 18679 | { | ||
| 18680 | 88 | ((enemy*)guys.spr(i))->hp=12*game->get_hero_dmgmult(); | |
| 18681 | |||
| 18682 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18683 | { | ||
| 18684 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
88 | if (get_bit(quest_rules,qr_PATRAS_USE_HARDCODED_OFFSETS)) |
| 18685 | { | ||
| 18686 |
2/3✓ Branch 0 taken 48 times.
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
88 | switch(dmisc5) |
| 18687 | { | ||
| 18688 | // Center eye shoots projectiles; make room for its firing tiles | ||
| 18689 | case 1: | ||
| 18690 | case 3: | ||
| 18691 | 48 | ((enemy*)guys.spr(i))->o_tile=d->e_tile+120; | |
| 18692 | 48 | break; | |
| 18693 | |||
| 18694 | // Center eyes does not shoot; use tiles two rows below for inner eyes. | ||
| 18695 | default: | ||
| 18696 | case 2: | ||
| 18697 | 40 | ((enemy*)guys.spr(i))->o_tile=d->e_tile+40; | |
| 18698 | 40 | break; | |
| 18699 | } | ||
| 18700 | 88 | } | |
| 18701 | ✗ | else ((enemy*)guys.spr(i))->o_tile = d->s_tile; | |
| 18702 | 88 | } | |
| 18703 | else | ||
| 18704 | { | ||
| 18705 | ✗ | ((enemy*)guys.spr(i))->o_tile=o_tile+1; | |
| 18706 | } | ||
| 18707 | |||
| 18708 | 88 | ((enemy*)guys.spr(i))->cs=dmisc9; | |
| 18709 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | if (dmisc27) ((enemy*)guys.spr(i))->hp=dmisc27; |
| 18710 | 88 | } | |
| 18711 | |||
| 18712 |
2/2✓ Branch 0 taken 94136 times.
✓ Branch 1 taken 25839 times.
|
119975 | if(flycnt>0) |
| 18713 | { | ||
| 18714 | 94136 | ((enemy*)guys.spr(i))->superman=true; | |
| 18715 | 94136 | } | |
| 18716 | else | ||
| 18717 | { | ||
| 18718 | 25839 | ((enemy*)guys.spr(i))->superman=false; | |
| 18719 | } | ||
| 18720 | |||
| 18721 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 119903 times.
|
119975 | if(((enemy*)guys.spr(i))->hp <= 0) |
| 18722 | { | ||
| 18723 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 72 times.
|
216 | for(int32_t j=i; j<index+flycnt+flycnt2; j++) |
| 18724 | { | ||
| 18725 | 144 | guys.swap(j,j+1); | |
| 18726 | 144 | } | |
| 18727 | |||
| 18728 |
3/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
|
72 | if (--flycnt2 == 0 && dmisc24 != 0) step += zslongToFix(dmisc24*100); |
| 18729 | 72 | } | |
| 18730 | else | ||
| 18731 | { | ||
| 18732 | 119903 | int32_t pos2 = ((enemy*)guys.spr(i))->misc; | |
| 18733 |
1/2✓ Branch 0 taken 119903 times.
✗ Branch 1 not taken.
|
119903 | double a2 = ((clk2-pos2*basesize/(dmisc2==0 ? 1 : dmisc2))*PI/(halfsize)); |
| 18734 | |||
| 18735 |
2/2✓ Branch 0 taken 7259 times.
✓ Branch 1 taken 112644 times.
|
119903 | if(dmisc4==0) |
| 18736 | { | ||
| 18737 |
2/2✓ Branch 0 taken 58268 times.
✓ Branch 1 taken 54376 times.
|
112644 | if(loopcnt>0) |
| 18738 | { | ||
| 18739 |
1/2✓ Branch 0 taken 58268 times.
✗ Branch 1 not taken.
|
58268 | guys.spr(i)->x = zc::math::Cos(a2+PI/2)*abs(dmisc32) - zc::math::Sin(pos2*PI*2/(dmisc2==0?1:dmisc2))*((int64_t)abs(dmisc32)-abs(dmisc30)); |
| 18740 |
1/2✓ Branch 0 taken 58268 times.
✗ Branch 1 not taken.
|
58268 | guys.spr(i)->y = -zc::math::Sin(a2+PI/2)*abs(dmisc32) + zc::math::Cos(pos2*PI*2/(dmisc2==0?1:dmisc2))*((int64_t)abs(dmisc32)-abs(dmisc30)); |
| 18741 | 58268 | } | |
| 18742 | else | ||
| 18743 | { | ||
| 18744 | 54376 | guys.spr(i)->x = zc::math::Cos(a2+PI/2)*abs(dmisc30); | |
| 18745 | 54376 | guys.spr(i)->y = -zc::math::Sin(a2+PI/2)*abs(dmisc30); | |
| 18746 | } | ||
| 18747 | |||
| 18748 | 112644 | temp_x=guys.spr(i)->x; | |
| 18749 | 112644 | temp_y=guys.spr(i)->y; | |
| 18750 | 112644 | } | |
| 18751 | else | ||
| 18752 | { | ||
| 18753 | 7259 | circle_x = zc::math::Cos(a2+PI/2)*abs(dmisc30); | |
| 18754 | 7259 | circle_y = -zc::math::Sin(a2+PI/2)*abs(dmisc30); | |
| 18755 | |||
| 18756 |
2/2✓ Branch 0 taken 3294 times.
✓ Branch 1 taken 3965 times.
|
7259 | if(loopcnt>0) |
| 18757 | { | ||
| 18758 | 3965 | guys.spr(i)->x = zc::math::Cos(a2+PI/2)*abs(dmisc30); | |
| 18759 |
1/2✓ Branch 0 taken 3965 times.
✗ Branch 1 not taken.
|
3965 | guys.spr(i)->y = (-zc::math::Sin(a2+PI/2)-zc::math::Cos(pos2*PI*2/(dmisc2 == 0 ? 1 : dmisc2)))*abs(dmisc32); |
| 18760 | 3965 | } | |
| 18761 | else | ||
| 18762 | { | ||
| 18763 | 3294 | guys.spr(i)->x = circle_x; | |
| 18764 | 3294 | guys.spr(i)->y = circle_y; | |
| 18765 | } | ||
| 18766 | |||
| 18767 | 7259 | temp_x=circle_x; | |
| 18768 | 7259 | temp_y=circle_y; | |
| 18769 | } | ||
| 18770 | |||
| 18771 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 18772 | 119903 | double ddir=atan2_MSVC2022_FIX(double(temp_y),double(temp_x)); | |
| 18773 | |||
| 18774 |
4/4✓ Branch 0 taken 22203 times.
✓ Branch 1 taken 97700 times.
✓ Branch 2 taken 7262 times.
✓ Branch 3 taken 14941 times.
|
119903 | if((ddir<=(((-5)*PI)/8))&&(ddir>(((-7)*PI)/8))) |
| 18775 | { | ||
| 18776 | 14941 | guys.spr(i)->dir=l_down; | |
| 18777 | 14941 | } | |
| 18778 |
4/4✓ Branch 0 taken 22190 times.
✓ Branch 1 taken 82772 times.
✓ Branch 2 taken 7262 times.
✓ Branch 3 taken 14928 times.
|
104962 | else if((ddir<=(((-3)*PI)/8))&&(ddir>(((-5)*PI)/8))) |
| 18779 | { | ||
| 18780 | 14928 | guys.spr(i)->dir=left; | |
| 18781 | 14928 | } | |
| 18782 |
4/4✓ Branch 0 taken 22199 times.
✓ Branch 1 taken 67835 times.
✓ Branch 2 taken 7262 times.
✓ Branch 3 taken 14937 times.
|
90034 | else if((ddir<=(((-1)*PI)/8))&&(ddir>(((-3)*PI)/8))) |
| 18783 | { | ||
| 18784 | 14937 | guys.spr(i)->dir=l_up; | |
| 18785 | 14937 | } | |
| 18786 |
4/4✓ Branch 0 taken 22258 times.
✓ Branch 1 taken 52839 times.
✓ Branch 2 taken 7262 times.
✓ Branch 3 taken 14996 times.
|
75097 | else if((ddir<=(((1)*PI)/8))&&(ddir>(((-1)*PI)/8))) |
| 18787 | { | ||
| 18788 | 14996 | guys.spr(i)->dir=up; | |
| 18789 | 14996 | } | |
| 18790 |
4/4✓ Branch 0 taken 22303 times.
✓ Branch 1 taken 37798 times.
✓ Branch 2 taken 7262 times.
✓ Branch 3 taken 15041 times.
|
60101 | else if((ddir<=(((3)*PI)/8))&&(ddir>(((1)*PI)/8))) |
| 18791 | { | ||
| 18792 | 15041 | guys.spr(i)->dir=r_up; | |
| 18793 | 15041 | } | |
| 18794 |
4/4✓ Branch 0 taken 22297 times.
✓ Branch 1 taken 22763 times.
✓ Branch 2 taken 7262 times.
✓ Branch 3 taken 15035 times.
|
45060 | else if((ddir<=(((5)*PI)/8))&&(ddir>(((3)*PI)/8))) |
| 18795 | { | ||
| 18796 | 15035 | guys.spr(i)->dir=right; | |
| 18797 | 15035 | } | |
| 18798 |
4/4✓ Branch 0 taken 22297 times.
✓ Branch 1 taken 7728 times.
✓ Branch 2 taken 7262 times.
✓ Branch 3 taken 15035 times.
|
30025 | else if((ddir<=(((7)*PI)/8))&&(ddir>(((5)*PI)/8))) |
| 18799 | { | ||
| 18800 | 15035 | guys.spr(i)->dir=r_down; | |
| 18801 | 15035 | } | |
| 18802 | else | ||
| 18803 | { | ||
| 18804 | 14990 | guys.spr(i)->dir=down; | |
| 18805 | } | ||
| 18806 | |||
| 18807 | 119903 | guys.spr(i)->x += x; | |
| 18808 | 119903 | guys.spr(i)->y = y-guys.spr(i)->y; | |
| 18809 | |||
| 18810 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 119903 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 81826 times.
✓ Branch 5 taken 38077 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 81826 times.
|
119903 | if((wpn>wEnemyWeapons || (wpn >= wScript1 && wpn <= wScript10)) && (dmisc5==2 || dmisc5== 3)) |
| 18811 | { | ||
| 18812 | /* | ||
| 18813 | if(!(zc_oldrand()&127)) | ||
| 18814 | { | ||
| 18815 | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID()); | ||
| 18816 | sfx(wpnsfx(wpn),pan(int32_t(x))); | ||
| 18817 | } | ||
| 18818 | */ | ||
| 18819 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 38077 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
38077 | if (((esPatra*)guys.spr(i))->clk5 < 0 && (editorflags & ENEMY_FLAG3)) |
| 18820 | { | ||
| 18821 | ✗ | if (((esPatra*)guys.spr(i))->clk4 <= 0 || ((esPatra*)guys.spr(i))->clk5 != -16) ++((esPatra*)guys.spr(i))->clk5; | |
| 18822 | ✗ | if (get_bit(quest_rules,qr_PATRAS_USE_HARDCODED_OFFSETS)) | |
| 18823 | { | ||
| 18824 | ✗ | if (dmisc5 == 3) | |
| 18825 | { | ||
| 18826 | ✗ | if (((esPatra*)guys.spr(i))->clk5 >= 0) ((esPatra*)guys.spr(i))->o_tile=d->e_tile+120; | |
| 18827 | ✗ | else if (((esPatra*)guys.spr(i))->clk5 >= -16) ((esPatra*)guys.spr(i))->o_tile=d->e_tile+200; | |
| 18828 | ✗ | else if (((esPatra*)guys.spr(i))->clk5 >= -48) ((esPatra*)guys.spr(i))->o_tile=d->e_tile+160; | |
| 18829 | ✗ | else ((esPatra*)guys.spr(i))->o_tile=d->e_tile+120; | |
| 18830 | ✗ | } | |
| 18831 | else | ||
| 18832 | { | ||
| 18833 | ✗ | if (((esPatra*)guys.spr(i))->clk5 >= 0) ((esPatra*)guys.spr(i))->o_tile=d->e_tile+40; | |
| 18834 | ✗ | else if (((esPatra*)guys.spr(i))->clk5 >= -16) ((esPatra*)guys.spr(i))->o_tile=d->e_tile+120; | |
| 18835 | ✗ | else if (((esPatra*)guys.spr(i))->clk5 >= -48) ((esPatra*)guys.spr(i))->o_tile=d->e_tile+80; | |
| 18836 | ✗ | else ((esPatra*)guys.spr(i))->o_tile=d->e_tile+40; | |
| 18837 | } | ||
| 18838 | ✗ | } | |
| 18839 | else | ||
| 18840 | { | ||
| 18841 | ✗ | if (((esPatra*)guys.spr(i))->clk5 >= 0) ((esPatra*)guys.spr(i))->o_tile=d->s_tile; | |
| 18842 | ✗ | else if (((esPatra*)guys.spr(i))->clk5 >= -16) ((esPatra*)guys.spr(i))->o_tile=d->s_tile+80; | |
| 18843 | ✗ | else if (((esPatra*)guys.spr(i))->clk5 >= -48) ((esPatra*)guys.spr(i))->o_tile=d->s_tile+40; | |
| 18844 | ✗ | else ((esPatra*)guys.spr(i))->o_tile=d->s_tile; | |
| 18845 | } | ||
| 18846 | ✗ | } | |
| 18847 |
4/6✓ Branch 0 taken 38077 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 38077 times.
✓ Branch 4 taken 38077 times.
✓ Branch 5 taken 38077 times.
|
38077 | else if ((dmisc19 || ((esPatra*)guys.spr(i))->clk5) && (((esPatra*)guys.spr(i))->clk4 <= 0 || ((esPatra*)guys.spr(i))->clk5 != -16)) ++((esPatra*)guys.spr(i))->clk5; |
| 18848 |
1/2✓ Branch 0 taken 38077 times.
✗ Branch 1 not taken.
|
38077 | if (((esPatra*)guys.spr(i))->clk4 > 0) --((esPatra*)guys.spr(i))->clk4; |
| 18849 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 38077 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
38077 | if (!dmisc25 || (dmisc25 == 1 && !((enemy*)guys.spr(i))->superman) || ((dmisc25 == 2 || dmisc25 == 3) && ((enemy*)guys.spr(i))->superman)) |
| 18850 | { | ||
| 18851 |
1/5✓ Branch 0 taken 38077 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
38077 | switch(dmisc20) //Patra Attack Patterns |
| 18852 | { | ||
| 18853 | case 4: //Single one rapidfires | ||
| 18854 | { | ||
| 18855 | ✗ | if (dofire && i == randeye) | |
| 18856 | { | ||
| 18857 | ✗ | ((esPatra*)guys.spr(i))->clk5 = -16; | |
| 18858 | ✗ | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES)) ((esPatra*)guys.spr(i))->clk5 = -48; | |
| 18859 | ✗ | ((esPatra*)guys.spr(i))->clk4 = 96; | |
| 18860 | ✗ | clk5 = -3; | |
| 18861 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = abs(clk5) + 16; | |
| 18862 | ✗ | } | |
| 18863 | ✗ | if (((esPatra*)guys.spr(i))->clk5 == -16 && (((esPatra*)guys.spr(i))->clk4 % 12) == 0) | |
| 18864 | { | ||
| 18865 | ✗ | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, guys.spr(i)->fakez); | |
| 18866 | ✗ | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18867 | ✗ | } | |
| 18868 | ✗ | break; | |
| 18869 | } | ||
| 18870 | case 3: //Ring | ||
| 18871 | { | ||
| 18872 | ✗ | if (dofire) | |
| 18873 | { | ||
| 18874 | ✗ | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 18875 | { | ||
| 18876 | ✗ | ((esPatra*)guys.spr(i))->clk5 = -48; | |
| 18877 | ✗ | clk5 = -48; | |
| 18878 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = 64; | |
| 18879 | ✗ | } | |
| 18880 | else | ||
| 18881 | { | ||
| 18882 | ✗ | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, guys.spr(i)->fakez); | |
| 18883 | ✗ | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18884 | ✗ | int32_t m=Ewpns.Count()-1; | |
| 18885 | ✗ | weapon *ew = (weapon*)(Ewpns.spr(m)); | |
| 18886 | |||
| 18887 | ✗ | ew->setAngle(atan2(double(HeroY()-y),double(HeroX()-x))); | |
| 18888 | ✗ | ((esPatra*)guys.spr(i))->clk5 = 0; | |
| 18889 | ✗ | clk5 = 0; | |
| 18890 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = 16; | |
| 18891 | } | ||
| 18892 | ✗ | } | |
| 18893 | ✗ | if (((esPatra*)guys.spr(i))->clk5 == -16) | |
| 18894 | { | ||
| 18895 | ✗ | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, guys.spr(i)->fakez); | |
| 18896 | ✗ | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18897 | ✗ | int32_t m=Ewpns.Count()-1; | |
| 18898 | ✗ | weapon *ew = (weapon*)(Ewpns.spr(m)); | |
| 18899 | |||
| 18900 | ✗ | ew->setAngle(atan2(double(HeroY()-y),double(HeroX()-x))); | |
| 18901 | ✗ | } | |
| 18902 | ✗ | break; | |
| 18903 | } | ||
| 18904 | case 2: //one after another | ||
| 18905 | { | ||
| 18906 | ✗ | if (dofire) | |
| 18907 | { | ||
| 18908 | ✗ | ((esPatra*)guys.spr(i))->clk5 = -48 - (12*(i-(index+flycnt+1))); | |
| 18909 | ✗ | clk5 = -48 - (12*flycnt2); | |
| 18910 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = abs(clk5) + 16; | |
| 18911 | ✗ | } | |
| 18912 | ✗ | if (((esPatra*)guys.spr(i))->clk5 == -16) | |
| 18913 | { | ||
| 18914 | ✗ | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, guys.spr(i)->fakez); | |
| 18915 | ✗ | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18916 | ✗ | } | |
| 18917 | ✗ | break; | |
| 18918 | } | ||
| 18919 | case 1: //random one eye | ||
| 18920 | { | ||
| 18921 | ✗ | if (dofire && i == randeye) | |
| 18922 | { | ||
| 18923 | ✗ | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES)) | |
| 18924 | { | ||
| 18925 | ✗ | ((esPatra*)guys.spr(i))->clk5 = -48; | |
| 18926 | ✗ | clk5 = -48; | |
| 18927 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = 64; | |
| 18928 | ✗ | } | |
| 18929 | else | ||
| 18930 | { | ||
| 18931 | ✗ | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, guys.spr(i)->fakez); | |
| 18932 | ✗ | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18933 | ✗ | ((esPatra*)guys.spr(i))->clk5 = 0; | |
| 18934 | ✗ | clk5 = 0; | |
| 18935 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = 16; | |
| 18936 | } | ||
| 18937 | ✗ | } | |
| 18938 | ✗ | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES) && ((esPatra*)guys.spr(i))->clk5 == -16) | |
| 18939 | { | ||
| 18940 | ✗ | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, guys.spr(i)->fakez); | |
| 18941 | ✗ | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18942 | ✗ | } | |
| 18943 | ✗ | break; | |
| 18944 | } | ||
| 18945 | default: //old behavior, all eyes can fire any time | ||
| 18946 | { | ||
| 18947 |
3/8✓ Branch 0 taken 38077 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 292 times.
✓ Branch 5 taken 292 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
38077 | if ((((dmisc18 && !(zc_oldrand() % zc_max(dmisc18, 1))) || |
| 18948 |
3/6✓ Branch 0 taken 38077 times.
✓ Branch 1 taken 292 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 292 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
38661 | (!dmisc18 && !(zc_oldrand()&127))) && (((esPatra*)guys.spr(i))->clk5 >= 0 || !(editorflags & ENEMY_FLAG3) || !get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18949 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 292 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
292 | && ((esPatra*)guys.spr(i))->clk5 >= dmisc19) && (!(editorflags & ENEMY_FLAG7) || (loopcnt == 0 && |
| 18950 | ✗ | (dmisc20 != 2 && (basesize*((int64_t)dmisc6 - (misc%dmisc6))) > 48)))) | |
| 18951 | { | ||
| 18952 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 292 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
292 | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 18953 | { | ||
| 18954 | ✗ | ((esPatra*)guys.spr(i))->clk5 = -48; | |
| 18955 | ✗ | if (editorflags & ENEMY_FLAG6) clk4 = 64; | |
| 18956 | ✗ | } | |
| 18957 | else | ||
| 18958 | { | ||
| 18959 | 292 | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 18960 | 292 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18961 | 292 | ((esPatra*)guys.spr(i))->clk5 = 0; | |
| 18962 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | if (editorflags & ENEMY_FLAG6) clk4 = 16; |
| 18963 | } | ||
| 18964 | 292 | } | |
| 18965 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 38077 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
38661 | if ((editorflags & ENEMY_FLAG3) && get_bit(quest_rules,qr_NEWENEMYTILES) && ((esPatra*)guys.spr(i))->clk5 == -16) |
| 18966 | { | ||
| 18967 | ✗ | addEwpn(guys.spr(i)->x,guys.spr(i)->y,guys.spr(i)->z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 18968 | ✗ | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18969 | ✗ | } | |
| 18970 | 38077 | break; | |
| 18971 | } | ||
| 18972 | } | ||
| 18973 | 38077 | } | |
| 18974 | 38077 | } | |
| 18975 | |||
| 18976 | } | ||
| 18977 | 119975 | } | |
| 18978 | 16602 | } | |
| 18979 | |||
| 18980 | 61532 | adjusted=true; | |
| 18981 | 61532 | return enemy::animate(index); | |
| 18982 | 62324 | } | |
| 18983 | |||
| 18984 | 133 | void ePatra::FirePatraWeapon() | |
| 18985 | { //.707 | ||
| 18986 | 133 | int32_t xoff = 0; | |
| 18987 | 133 | int32_t yoff = 0; | |
| 18988 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | if ( SIZEflags&guyflagOVERRIDE_HIT_WIDTH ) |
| 18989 | { | ||
| 18990 | ✗ | xoff += (hxsz/2)-8; | |
| 18991 | //Z_scripterrlog("width flag enabled. xoff = %d\n", xoff); | ||
| 18992 | ✗ | } | |
| 18993 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | if ( SIZEflags&guyflagOVERRIDE_HIT_HEIGHT ) |
| 18994 | { | ||
| 18995 | ✗ | yoff += (hysz/2)-8; | |
| 18996 | //Z_scripterrlog("width flag enabled. yoff = %d\n", yoff); | ||
| 18997 | ✗ | } | |
| 18998 | 133 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 18999 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
|
133 | switch (dmisc28) |
| 19000 | { | ||
| 19001 | case patrat8SHOT: //Fire Wizzrobe | ||
| 19002 | case patrat4SHOTDIAG: | ||
| 19003 | case patrat4SHOTRAND: | ||
| 19004 | ✗ | if (dmisc28 != patrat4SHOTRAND || (zc_oldrand()%2)) //if it's the 4 shot rand type, only let it through half the time. Break is within so it doesn't do both, but if it skips this one it'll always do the other one. | |
| 19005 | { | ||
| 19006 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,l_up,-1, getUID(),false)); | |
| 19007 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19008 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19009 | ✗ | if (wpn != ewFlame && wpn != ewFlame2) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= .707; //Fire already does this internall for asome bizarre reason. | |
| 19010 | |||
| 19011 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,l_down,-1, getUID(),false)); | |
| 19012 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19013 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19014 | ✗ | if (wpn != ewFlame && wpn != ewFlame2) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= .707; //Fire already does this internall for asome bizarre reason. | |
| 19015 | |||
| 19016 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,r_up,-1, getUID(),false)); | |
| 19017 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19018 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19019 | ✗ | if (wpn != ewFlame && wpn != ewFlame2) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= .707; //Fire already does this internall for asome bizarre reason. | |
| 19020 | |||
| 19021 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,r_down,-1, getUID(),false)); | |
| 19022 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19023 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19024 | ✗ | if (wpn != ewFlame && wpn != ewFlame2) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= .707; //Fire already does this internall for asome bizarre reason. | |
| 19025 | |||
| 19026 | ✗ | if (dmisc28 == patrat4SHOTDIAG || dmisc28 == patrat4SHOTRAND) break; | |
| 19027 | ✗ | } | |
| 19028 | |||
| 19029 | [[fallthrough]]; | ||
| 19030 | case patrat4SHOTCARD: //Stalfos 3 | ||
| 19031 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,up,-1, getUID(),false)); | |
| 19032 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19033 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19034 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,down,-1, getUID(),false)); | |
| 19035 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19036 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19037 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,left,-1, getUID(),false)); | |
| 19038 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19039 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19040 | ✗ | Ewpns.add(new weapon(x+xoff,y+yoff,z,wpn,1,wdp,right,-1, getUID(),false)); | |
| 19041 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; | |
| 19042 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->moveflags &= ~FLAG_CAN_PITFALL; //No falling in pits | |
| 19043 | ✗ | break; | |
| 19044 | |||
| 19045 | default: | ||
| 19046 | 133 | addEwpn(x,y,z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 19047 |
1/2✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
|
133 | if (dmisc28 == patratBREATH) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->angle += (zc_rand(20,-20)/100.0)*PI; |
| 19048 | 133 | double anglestore = ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->angle; | |
| 19049 |
3/6✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 133 times.
|
133 | if (dmisc28 == patrat1SHOTFAST || dmisc28 == patrat3SHOTFAST || dmisc28 == patrat5SHOTFAST) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= 2; |
| 19050 |
4/8✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 133 times.
|
133 | if (dmisc28 == patrat3SHOT || dmisc28 == patrat3SHOTFAST || dmisc28 == patrat5SHOT || dmisc28 == patrat5SHOTFAST) |
| 19051 | { | ||
| 19052 | ✗ | addEwpn(x,y,z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 19053 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->angle = anglestore + (double)0.46364761; | |
| 19054 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step += 0.1180; | |
| 19055 | ✗ | if (dmisc28 == patrat3SHOTFAST || dmisc28 == patrat5SHOTFAST) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= 2; | |
| 19056 | ✗ | addEwpn(x,y,z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 19057 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->angle = anglestore - (double)0.46364761; | |
| 19058 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step += 0.1180; | |
| 19059 | ✗ | if (dmisc28 == patrat3SHOTFAST || dmisc28 == patrat5SHOTFAST) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= 2; | |
| 19060 | ✗ | if (dmisc28 == patrat5SHOT || dmisc28 == patrat5SHOTFAST) | |
| 19061 | { | ||
| 19062 | ✗ | addEwpn(x,y,z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 19063 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->angle = anglestore + (double)0.78539816; | |
| 19064 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step += 0.4142; | |
| 19065 | ✗ | if (dmisc28 == patrat5SHOTFAST) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= 2; | |
| 19066 | ✗ | addEwpn(x,y,z,wpn,3,wdp,dir,getUID(), 0, fakez); | |
| 19067 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->angle = anglestore - (double)0.78539816; | |
| 19068 | ✗ | ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step += 0.4142; | |
| 19069 | ✗ | if (dmisc28 == patrat5SHOTFAST) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->step *= 2; | |
| 19070 | ✗ | } | |
| 19071 | ✗ | } | |
| 19072 | 133 | break; | |
| 19073 | |||
| 19074 | } | ||
| 19075 | 133 | sfx(wpnsfx(wpn),pan(int32_t(x))); | |
| 19076 | //+0.46364761 | ||
| 19077 | //11.80 | ||
| 19078 | 133 | } | |
| 19079 | |||
| 19080 | 124842 | void ePatra::draw(BITMAP *dest) | |
| 19081 | { | ||
| 19082 | 124842 | tile=o_tile; | |
| 19083 | 124842 | update_enemy_frame(); | |
| 19084 | 124842 | enemy::draw(dest); | |
| 19085 | 124842 | } | |
| 19086 | |||
| 19087 | ✗ | int32_t ePatra::defend(int32_t wpnId, int32_t *power, int32_t edef) | |
| 19088 | { | ||
| 19089 | ✗ | int32_t ret = enemy::defend(wpnId, power, edef); | |
| 19090 | |||
| 19091 | ✗ | if(ret < 0 && (flycnt||flycnt2)) | |
| 19092 | ✗ | return 0; | |
| 19093 | |||
| 19094 | ✗ | return ret; | |
| 19095 | ✗ | } | |
| 19096 | |||
| 19097 | 908 | int32_t ePatra::defendNew(int32_t wpnId, int32_t *power, int32_t edef, byte unblockable) | |
| 19098 | { | ||
| 19099 | 908 | int32_t ret = enemy::defendNew(wpnId, power, edef, unblockable); | |
| 19100 | |||
| 19101 |
6/6✓ Branch 0 taken 805 times.
✓ Branch 1 taken 103 times.
✓ Branch 2 taken 397 times.
✓ Branch 3 taken 408 times.
✓ Branch 4 taken 252 times.
✓ Branch 5 taken 145 times.
|
908 | if(ret < 0 && (flycnt||flycnt2)) |
| 19102 | 660 | return 0; | |
| 19103 | |||
| 19104 | 248 | return ret; | |
| 19105 | 908 | } | |
| 19106 | |||
| 19107 | 1512 | esPatra::esPatra(zfix X,zfix Y,int32_t Id,int32_t Clk, sprite * prnt) : enemy(X,Y,Id,Clk), parent(prnt) | |
| 19108 | 1008 | { | |
| 19109 | //cs=8; | ||
| 19110 | 504 | item_set=0; | |
| 19111 | 504 | misc=clk; | |
| 19112 | 504 | clk4 = 0; | |
| 19113 | 504 | clk5 = 0; | |
| 19114 | 504 | clk = -((misc*21)>>1)-1; | |
| 19115 |
3/6✓ Branch 0 taken 504 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 504 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 504 times.
✗ Branch 5 not taken.
|
504 | yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 19116 | 504 | hxsz=12; | |
| 19117 | 504 | hysz=12; | |
| 19118 | 504 | hxofs=2; | |
| 19119 | 504 | hyofs=2; | |
| 19120 | 504 | extend = 0; | |
| 19121 | 504 | txsz = 1; | |
| 19122 | 504 | tysz = 1; | |
| 19123 | /* //These need to be separate enemy editor fields. This enemy class also it's draw altered to correctly support big stuff. | ||
| 19124 | enemy *prntenemy = (enemy *) guys.getByUID(parent->getUID()); | ||
| 19125 | int32_t prntSIZEflags = prntenemy->SIZEflags; | ||
| 19126 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = prntenemy->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. | ||
| 19127 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 19128 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 19129 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = prntenemy->tysz; if ( tysz > 1 ) extend = 3; } | ||
| 19130 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = prntenemy->hxsz; | ||
| 19131 | else | ||
| 19132 | hxsz=12; | ||
| 19133 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = prntenemy->hysz; | ||
| 19134 | else | ||
| 19135 | hysz=12; | ||
| 19136 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = prntenemy->hzsz; | ||
| 19137 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = prntenemy->hxofs; | ||
| 19138 | else | ||
| 19139 | hxofs=2; | ||
| 19140 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = prntenemy->hyofs; | ||
| 19141 | else hyofs=2; | ||
| 19142 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 19143 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)prntenemy->xofs; | ||
| 19144 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) | ||
| 19145 | { | ||
| 19146 | yofs = (int32_t)prntenemy->yofs; //This seems to be setting to +48 or something with any value set?! -Z | ||
| 19147 | } | ||
| 19148 | |||
| 19149 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)prntenemy->zofs; | ||
| 19150 | */ | ||
| 19151 | 504 | mainguy=count_enemy=false; | |
| 19152 | 504 | bgsfx=-1; | |
| 19153 | //o_tile=0; | ||
| 19154 | 504 | flags &= (~guy_neverret); | |
| 19155 | 504 | deadsfx = WAV_EDEAD; | |
| 19156 | 504 | hitsfx = WAV_EHIT; | |
| 19157 | 504 | isCore = false; | |
| 19158 | 504 | } | |
| 19159 | |||
| 19160 | 371975 | bool esPatra::animate(int32_t index) | |
| 19161 | { | ||
| 19162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 371975 times.
|
371975 | if(switch_hooked) return enemy::animate(index); |
| 19163 |
2/2✓ Branch 0 taken 7722 times.
✓ Branch 1 taken 364253 times.
|
371975 | if(dying) |
| 19164 | 7722 | return Dead(index); | |
| 19165 | |||
| 19166 | 364253 | return enemy::animate(index); | |
| 19167 | 371975 | } | |
| 19168 | |||
| 19169 | 746702 | void esPatra::draw(BITMAP *dest) | |
| 19170 | { | ||
| 19171 |
2/2✓ Branch 0 taken 544720 times.
✓ Branch 1 taken 201982 times.
|
746702 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 19172 | { | ||
| 19173 | 544720 | tile = o_tile+(clk&3); | |
| 19174 | |||
| 19175 |
8/9✓ Branch 0 taken 67770 times.
✓ Branch 1 taken 69066 times.
✓ Branch 2 taken 67800 times.
✓ Branch 3 taken 67996 times.
✓ Branch 4 taken 67484 times.
✓ Branch 5 taken 68044 times.
✓ Branch 6 taken 68474 times.
✓ Branch 7 taken 68086 times.
✗ Branch 8 not taken.
|
544720 | switch(dir) //directions get screwed up after 8. *shrug* |
| 19176 | { | ||
| 19177 | case up: //u | ||
| 19178 | 67770 | flip=0; | |
| 19179 | 67770 | break; | |
| 19180 | |||
| 19181 | case down: //d | ||
| 19182 | 69066 | flip=0; | |
| 19183 | 69066 | tile+=4; | |
| 19184 | 69066 | break; | |
| 19185 | |||
| 19186 | case left: //l | ||
| 19187 | 67800 | flip=0; | |
| 19188 | 67800 | tile+=8; | |
| 19189 | 67800 | break; | |
| 19190 | |||
| 19191 | case right: //r | ||
| 19192 | 67996 | flip=0; | |
| 19193 | 67996 | tile+=12; | |
| 19194 | 67996 | break; | |
| 19195 | |||
| 19196 | case l_up: //ul | ||
| 19197 | 67484 | flip=0; | |
| 19198 | 67484 | tile+=20; | |
| 19199 | 67484 | break; | |
| 19200 | |||
| 19201 | case r_up: //ur | ||
| 19202 | 68044 | flip=0; | |
| 19203 | 68044 | tile+=24; | |
| 19204 | 68044 | break; | |
| 19205 | |||
| 19206 | case l_down: //dl | ||
| 19207 | 68474 | flip=0; | |
| 19208 | 68474 | tile+=28; | |
| 19209 | 68474 | break; | |
| 19210 | |||
| 19211 | case r_down: //dr | ||
| 19212 | 68086 | flip=0; | |
| 19213 | 68086 | tile+=32; | |
| 19214 | 68086 | break; | |
| 19215 | } | ||
| 19216 | 544720 | } | |
| 19217 | else | ||
| 19218 | { | ||
| 19219 | 201982 | tile = o_tile+((clk&2)>>1); | |
| 19220 | } | ||
| 19221 | |||
| 19222 |
2/2✓ Branch 0 taken 37768 times.
✓ Branch 1 taken 708934 times.
|
746702 | if(clk>=0) |
| 19223 | 708934 | enemy::draw(dest); | |
| 19224 | 746702 | } | |
| 19225 | |||
| 19226 | |||
| 19227 | 6 | ePatraBS::ePatraBS(zfix ,zfix ,int32_t Id,int32_t Clk) : enemy((zfix)128,(zfix)48,Id,Clk) | |
| 19228 | 6 | { | |
| 19229 | 3 | adjusted=false; | |
| 19230 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | dir=(zc_oldrand()&7)+8; |
| 19231 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | step=0.25; |
| 19232 | 3 | clk4 = 0; | |
| 19233 | 3 | clk5 = 0; | |
| 19234 | //flycnt=6; flycnt2=0; | ||
| 19235 | 3 | flycnt=dmisc1; | |
| 19236 | 3 | flycnt2=0; // PatraBS doesn't have inner rings! | |
| 19237 | 3 | loopcnt=0; | |
| 19238 | |||
| 19239 | 3 | SIZEflags = d->SIZEflags; | |
| 19240 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = d->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 19241 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 19242 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 19243 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3 | if ( ((SIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = d->tysz; if ( tysz > 1 ) extend = 3; } |
| 19244 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = d->hxsz; |
| 19245 | 3 | else hxsz = 32; | |
| 19246 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = d->hysz; |
| 19247 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if ( ((SIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = d->hzsz; |
| 19248 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if ( (SIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = d->hxofs; |
| 19249 | 3 | else hxofs=-8; | |
| 19250 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if ( (SIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = d->hyofs; |
| 19251 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 19252 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)d->xofs; |
| 19253 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 19254 | { | ||
| 19255 | ✗ | yofs = (int32_t)d->yofs; //This seems to be setting to +48 or something with any value set?! -Z | |
| 19256 | ✗ | yofs += (get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) ; //this offset fixes yofs not plaing properly. -Z | |
| 19257 | ✗ | } | |
| 19258 | |||
| 19259 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if ( (SIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) zofs = (int32_t)d->zofs; |
| 19260 | |||
| 19261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(dmisc6<int16_t(1))dmisc6=1; // ratio cannot be 0! |
| 19262 | |||
| 19263 | //nets+4480; | ||
| 19264 | 3 | } | |
| 19265 | |||
| 19266 | 1862 | bool ePatraBS::animate(int32_t index) | |
| 19267 | { | ||
| 19268 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1862 times.
|
1862 | if(switch_hooked) return enemy::animate(index); |
| 19269 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 1808 times.
|
1862 | if(dying) |
| 19270 | 54 | return Dead(index); | |
| 19271 | |||
| 19272 |
2/2✓ Branch 0 taken 1366 times.
✓ Branch 1 taken 442 times.
|
1808 | if(clk==0) |
| 19273 | { | ||
| 19274 | 442 | removearmos(x,y,ffcactivated); | |
| 19275 | 442 | } | |
| 19276 | |||
| 19277 | 1808 | variable_walk_8(rate,homing,hrate,spw_floater); | |
| 19278 | |||
| 19279 |
2/2✓ Branch 0 taken 1789 times.
✓ Branch 1 taken 19 times.
|
1808 | if(++clk2>90) |
| 19280 | { | ||
| 19281 | 19 | clk2=0; | |
| 19282 | |||
| 19283 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 7 times.
|
19 | if(loopcnt) |
| 19284 | 12 | --loopcnt; | |
| 19285 | else | ||
| 19286 | { | ||
| 19287 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 3 times.
|
7 | if((misc%dmisc6)==0) |
| 19288 | 4 | loopcnt=dmisc7; | |
| 19289 | } | ||
| 19290 | |||
| 19291 | 19 | ++misc; | |
| 19292 | 19 | } | |
| 19293 | |||
| 19294 | // double size=1;; | ||
| 19295 |
2/2✓ Branch 0 taken 4455 times.
✓ Branch 1 taken 1808 times.
|
6263 | for(int32_t i=index+1; i<index+flycnt+1; i++) |
| 19296 | { | ||
| 19297 |
2/2✓ Branch 0 taken 4437 times.
✓ Branch 1 taken 18 times.
|
4455 | if(!adjusted) |
| 19298 | { | ||
| 19299 | 18 | ((enemy*)guys.spr(i))->hp=dmisc3; | |
| 19300 | |||
| 19301 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 19302 | { | ||
| 19303 | 18 | ((enemy*)guys.spr(i))->o_tile=o_tile+dmisc8; | |
| 19304 | 18 | } | |
| 19305 | else | ||
| 19306 | { | ||
| 19307 | ✗ | ((enemy*)guys.spr(i))->o_tile=o_tile+1; | |
| 19308 | } | ||
| 19309 | |||
| 19310 | 18 | ((enemy*)guys.spr(i))->cs = dmisc9; | |
| 19311 | 18 | } | |
| 19312 | |||
| 19313 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 4437 times.
|
4455 | if(((enemy*)guys.spr(i))->hp <= 0) |
| 19314 | { | ||
| 19315 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 18 times.
|
44 | for(int32_t j=i; j<index+flycnt+flycnt2; j++) |
| 19316 | { | ||
| 19317 | 26 | guys.swap(j,j+1); | |
| 19318 | 26 | } | |
| 19319 | |||
| 19320 | 18 | --flycnt; | |
| 19321 | 18 | } | |
| 19322 | else | ||
| 19323 | { | ||
| 19324 | 4437 | int32_t pos2 = ((enemy*)guys.spr(i))->misc; | |
| 19325 |
1/2✓ Branch 0 taken 4437 times.
✗ Branch 1 not taken.
|
4437 | double a2 = ((int64_t)clk2-pos2*90/(dmisc1==0?1:dmisc1))*PI/45; |
| 19326 | 4437 | temp_x = zc::math::Cos(a2+PI/2)*45; | |
| 19327 | 4437 | temp_y = -zc::math::Sin(a2+PI/2)*45; | |
| 19328 | |||
| 19329 |
2/2✓ Branch 0 taken 2305 times.
✓ Branch 1 taken 2132 times.
|
4437 | if(loopcnt>0) |
| 19330 | { | ||
| 19331 | 2305 | guys.spr(i)->x = zc::math::Cos(a2+PI/2)*45; | |
| 19332 |
1/2✓ Branch 0 taken 2305 times.
✗ Branch 1 not taken.
|
2305 | guys.spr(i)->y = (-zc::math::Sin(a2+PI/2)-zc::math::Cos(pos2*PI*2/(dmisc1==0?1:dmisc1)))*22.5; |
| 19333 | 2305 | } | |
| 19334 | else | ||
| 19335 | { | ||
| 19336 | 2132 | guys.spr(i)->x = temp_x; | |
| 19337 | 2132 | guys.spr(i)->y = temp_y; | |
| 19338 | } | ||
| 19339 | |||
| 19340 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 19341 | 4437 | double ddir=atan2_MSVC2022_FIX(double(temp_y),double(temp_x)); | |
| 19342 | |||
| 19343 |
4/4✓ Branch 0 taken 861 times.
✓ Branch 1 taken 3576 times.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 551 times.
|
4437 | if((ddir<=(((-5)*PI)/8))&&(ddir>(((-7)*PI)/8))) |
| 19344 | { | ||
| 19345 | 551 | guys.spr(i)->dir=l_down; | |
| 19346 | 551 | } | |
| 19347 |
4/4✓ Branch 0 taken 844 times.
✓ Branch 1 taken 3042 times.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 534 times.
|
3886 | else if((ddir<=(((-3)*PI)/8))&&(ddir>(((-5)*PI)/8))) |
| 19348 | { | ||
| 19349 | 534 | guys.spr(i)->dir=left; | |
| 19350 | 534 | } | |
| 19351 |
4/4✓ Branch 0 taken 832 times.
✓ Branch 1 taken 2520 times.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 522 times.
|
3352 | else if((ddir<=(((-1)*PI)/8))&&(ddir>(((-3)*PI)/8))) |
| 19352 | { | ||
| 19353 | 522 | guys.spr(i)->dir=l_up; | |
| 19354 | 522 | } | |
| 19355 |
4/4✓ Branch 0 taken 874 times.
✓ Branch 1 taken 1956 times.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 564 times.
|
2830 | else if((ddir<=(((1)*PI)/8))&&(ddir>(((-1)*PI)/8))) |
| 19356 | { | ||
| 19357 | 564 | guys.spr(i)->dir=up; | |
| 19358 | 564 | } | |
| 19359 |
4/4✓ Branch 0 taken 855 times.
✓ Branch 1 taken 1411 times.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 545 times.
|
2266 | else if((ddir<=(((3)*PI)/8))&&(ddir>(((1)*PI)/8))) |
| 19360 | { | ||
| 19361 | 545 | guys.spr(i)->dir=r_up; | |
| 19362 | 545 | } | |
| 19363 |
4/4✓ Branch 0 taken 872 times.
✓ Branch 1 taken 849 times.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 562 times.
|
1721 | else if((ddir<=(((5)*PI)/8))&&(ddir>(((3)*PI)/8))) |
| 19364 | { | ||
| 19365 | 562 | guys.spr(i)->dir=right; | |
| 19366 | 562 | } | |
| 19367 |
4/4✓ Branch 0 taken 864 times.
✓ Branch 1 taken 295 times.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 554 times.
|
1159 | else if((ddir<=(((7)*PI)/8))&&(ddir>(((5)*PI)/8))) |
| 19368 | { | ||
| 19369 | 554 | guys.spr(i)->dir=r_down; | |
| 19370 | 554 | } | |
| 19371 | else | ||
| 19372 | { | ||
| 19373 | 605 | guys.spr(i)->dir=down; | |
| 19374 | } | ||
| 19375 | |||
| 19376 | 4437 | guys.spr(i)->x += x; | |
| 19377 | 4437 | guys.spr(i)->y += y; | |
| 19378 | } | ||
| 19379 | 4455 | } | |
| 19380 | |||
| 19381 | 1808 | adjusted=true; | |
| 19382 | 1808 | return enemy::animate(index); | |
| 19383 | 1862 | } | |
| 19384 | |||
| 19385 | 3724 | void ePatraBS::draw(BITMAP *dest) | |
| 19386 | { | ||
| 19387 | 3724 | tile=o_tile; | |
| 19388 | |||
| 19389 |
1/2✓ Branch 0 taken 3724 times.
✗ Branch 1 not taken.
|
3724 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 19390 | { | ||
| 19391 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 19392 | 3724 | double ddir=atan2_MSVC2022_FIX(double(y-(Hero.y)),double(Hero.x-x)); | |
| 19393 | |||
| 19394 |
4/4✓ Branch 0 taken 404 times.
✓ Branch 1 taken 3320 times.
✓ Branch 2 taken 302 times.
✓ Branch 3 taken 102 times.
|
3724 | if((ddir<=(((-5)*PI)/8))&&(ddir>(((-7)*PI)/8))) |
| 19395 | { | ||
| 19396 | 102 | lookat=l_down; | |
| 19397 | 102 | } | |
| 19398 |
4/4✓ Branch 0 taken 612 times.
✓ Branch 1 taken 3010 times.
✓ Branch 2 taken 302 times.
✓ Branch 3 taken 310 times.
|
3622 | else if((ddir<=(((-3)*PI)/8))&&(ddir>(((-5)*PI)/8))) |
| 19399 | { | ||
| 19400 | 310 | lookat=down; | |
| 19401 | 310 | } | |
| 19402 |
4/4✓ Branch 0 taken 1254 times.
✓ Branch 1 taken 2058 times.
✓ Branch 2 taken 302 times.
✓ Branch 3 taken 952 times.
|
3312 | else if((ddir<=(((-1)*PI)/8))&&(ddir>(((-3)*PI)/8))) |
| 19403 | { | ||
| 19404 | 952 | lookat=r_down; | |
| 19405 | 952 | } | |
| 19406 |
4/4✓ Branch 0 taken 1988 times.
✓ Branch 1 taken 372 times.
✓ Branch 2 taken 302 times.
✓ Branch 3 taken 1686 times.
|
2360 | else if((ddir<=(((1)*PI)/8))&&(ddir>(((-1)*PI)/8))) |
| 19407 | { | ||
| 19408 | 1686 | lookat=right; | |
| 19409 | 1686 | } | |
| 19410 |
4/4✓ Branch 0 taken 482 times.
✓ Branch 1 taken 192 times.
✓ Branch 2 taken 302 times.
✓ Branch 3 taken 180 times.
|
674 | else if((ddir<=(((3)*PI)/8))&&(ddir>(((1)*PI)/8))) |
| 19411 | { | ||
| 19412 | 180 | lookat=r_up; | |
| 19413 | 180 | } | |
| 19414 |
3/4✓ Branch 0 taken 302 times.
✓ Branch 1 taken 192 times.
✓ Branch 2 taken 302 times.
✗ Branch 3 not taken.
|
494 | else if((ddir<=(((5)*PI)/8))&&(ddir>(((3)*PI)/8))) |
| 19415 | { | ||
| 19416 | ✗ | lookat=up; | |
| 19417 | ✗ | } | |
| 19418 |
3/4✓ Branch 0 taken 302 times.
✓ Branch 1 taken 192 times.
✓ Branch 2 taken 302 times.
✗ Branch 3 not taken.
|
494 | else if((ddir<=(((7)*PI)/8))&&(ddir>(((5)*PI)/8))) |
| 19419 | { | ||
| 19420 | ✗ | lookat=l_up; | |
| 19421 | ✗ | } | |
| 19422 | else | ||
| 19423 | { | ||
| 19424 | 494 | lookat=left; | |
| 19425 | } | ||
| 19426 | |||
| 19427 |
6/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 310 times.
✓ Branch 3 taken 494 times.
✓ Branch 4 taken 1686 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 180 times.
✓ Branch 7 taken 102 times.
✓ Branch 8 taken 952 times.
|
3724 | switch(lookat) //directions get screwed up after 8. *shrug* |
| 19428 | { | ||
| 19429 | case up: //u | ||
| 19430 | ✗ | flip=0; | |
| 19431 | ✗ | break; | |
| 19432 | |||
| 19433 | case down: //d | ||
| 19434 | 310 | flip=0; | |
| 19435 | 310 | tile+=8; | |
| 19436 | 310 | break; | |
| 19437 | |||
| 19438 | case left: //l | ||
| 19439 | 494 | flip=0; | |
| 19440 | 494 | tile+=40; | |
| 19441 | 494 | break; | |
| 19442 | |||
| 19443 | case right: //r | ||
| 19444 | 1686 | flip=0; | |
| 19445 | 1686 | tile+=48; | |
| 19446 | 1686 | break; | |
| 19447 | |||
| 19448 | case l_up: //ul | ||
| 19449 | ✗ | flip=0; | |
| 19450 | ✗ | tile+=80; | |
| 19451 | ✗ | break; | |
| 19452 | |||
| 19453 | case r_up: //ur | ||
| 19454 | 180 | flip=0; | |
| 19455 | 180 | tile+=88; | |
| 19456 | 180 | break; | |
| 19457 | |||
| 19458 | case l_down: //dl | ||
| 19459 | 102 | flip=0; | |
| 19460 | 102 | tile+=120; | |
| 19461 | 102 | break; | |
| 19462 | |||
| 19463 | case r_down: //dr | ||
| 19464 | 952 | flip=0; | |
| 19465 | 952 | tile+=128; | |
| 19466 | 952 | break; | |
| 19467 | } | ||
| 19468 | |||
| 19469 | 3724 | tile+=(2*(clk&3)); | |
| 19470 | 3724 | xofs-=8; | |
| 19471 | 3724 | yofs-=8; | |
| 19472 | 3724 | drawblock(dest,15); | |
| 19473 | 3724 | xofs+=8; | |
| 19474 | 3724 | yofs+=8; | |
| 19475 | 3724 | } | |
| 19476 | else | ||
| 19477 | { | ||
| 19478 | ✗ | flip=(clk&1); | |
| 19479 | ✗ | xofs-=8; | |
| 19480 | ✗ | yofs-=8; | |
| 19481 | ✗ | enemy::draw(dest); | |
| 19482 | ✗ | xofs+=16; | |
| 19483 | ✗ | enemy::draw(dest); | |
| 19484 | ✗ | yofs+=16; | |
| 19485 | ✗ | enemy::draw(dest); | |
| 19486 | ✗ | xofs-=16; | |
| 19487 | ✗ | enemy::draw(dest); | |
| 19488 | ✗ | xofs+=8; | |
| 19489 | ✗ | yofs-=8; | |
| 19490 | } | ||
| 19491 | 3724 | } | |
| 19492 | |||
| 19493 | ✗ | int32_t ePatraBS::defend(int32_t wpnId, int32_t *power, int32_t edef) | |
| 19494 | { | ||
| 19495 | ✗ | int32_t ret = enemy::defend(wpnId, power, edef); | |
| 19496 | |||
| 19497 | ✗ | if(ret < 0 && (flycnt||flycnt2)) | |
| 19498 | ✗ | return 0; | |
| 19499 | |||
| 19500 | ✗ | return ret; | |
| 19501 | ✗ | } | |
| 19502 | |||
| 19503 | 25 | int32_t ePatraBS::defendNew(int32_t wpnId, int32_t *power, int32_t edef, byte unblockable) | |
| 19504 | { | ||
| 19505 | 25 | int32_t ret = enemy::defendNew(wpnId, power, edef, unblockable); | |
| 19506 | |||
| 19507 |
4/6✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 19 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
25 | if(ret < 0 && (flycnt||flycnt2)) |
| 19508 | 19 | return 0; | |
| 19509 | |||
| 19510 | 6 | return ret; | |
| 19511 | 25 | } | |
| 19512 | |||
| 19513 | 54 | esPatraBS::esPatraBS(zfix X,zfix Y,int32_t Id,int32_t Clk, sprite * prnt) : enemy(X,Y,Id,Clk), parent(prnt) | |
| 19514 | 36 | { | |
| 19515 | //cs=csBOSS; | ||
| 19516 | 18 | item_set=0; | |
| 19517 | 18 | misc=clk; | |
| 19518 | 18 | clk = -((misc*21)>>1)-1; | |
| 19519 | 18 | clk4 = 0; | |
| 19520 | 18 | clk5 = 0; | |
| 19521 |
2/4✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | enemy *prntenemy = (enemy *) guys.getByUID(parent->getUID()); |
| 19522 | 18 | int32_t prntSIZEflags = prntenemy->SIZEflags; | |
| 19523 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18 | if ( ((prntSIZEflags&guyflagOVERRIDE_TILE_WIDTH) != 0) && txsz > 0 ) { txsz = prntenemy->txsz; if ( txsz > 1 ) extend = 3; } //! Don;t forget to set extend if the tilesize is > 1. |
| 19524 | //al_trace("->txsz:%i\n", txsz); Verified that this is setting the value. -Z | ||
| 19525 | // al_trace("Enemy txsz:%i\n", txsz); | ||
| 19526 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18 | if ( ((prntSIZEflags&guyflagOVERRIDE_TILE_HEIGHT) != 0) && tysz > 0 ) { tysz = prntenemy->tysz; if ( tysz > 1 ) extend = 3; } |
| 19527 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18 | if ( ((prntSIZEflags&guyflagOVERRIDE_HIT_WIDTH) != 0) && hxsz >= 0 ) hxsz = prntenemy->hxsz; |
| 19528 | 18 | else hxsz=16; | |
| 19529 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18 | if ( ((prntSIZEflags&guyflagOVERRIDE_HIT_HEIGHT) != 0) && hysz >= 0 ) hysz = prntenemy->hysz; |
| 19530 | 18 | else hysz=16; | |
| 19531 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18 | if ( ((prntSIZEflags&guyflagOVERRIDE_HIT_Z_HEIGHT) != 0) && hzsz >= 0 ) hzsz = prntenemy->hzsz; |
| 19532 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if ( (prntSIZEflags&guyflagOVERRIDE_HIT_X_OFFSET) != 0 ) hxofs = prntenemy->hxofs; |
| 19533 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if ( (prntSIZEflags&guyflagOVERRIDE_HIT_Y_OFFSET) != 0 ) hyofs = prntenemy->hyofs; |
| 19534 | 18 | else hyofs=2; | |
| 19535 | // if ( (SIZEflags&guyflagOVERRIDEHITZOFFSET) != 0 ) hzofs = hzofs; | ||
| 19536 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18 | if ( (prntSIZEflags&guyflagOVERRIDE_DRAW_X_OFFSET) != 0 ) xofs = (int32_t)prntenemy->xofs; |
| 19537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if ( (prntSIZEflags&guyflagOVERRIDE_DRAW_Y_OFFSET) != 0 ) |
| 19538 | { | ||
| 19539 | ✗ | yofs = (int32_t)prntenemy->yofs; | |
| 19540 | ✗ | } | |
| 19541 |
3/6✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
|
18 | else yofs=(get_bit(quest_rules, qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 19542 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18 | if ( (prntSIZEflags&guyflagOVERRIDE_DRAW_Z_OFFSET) != 0 ) prntenemy->zofs = (int32_t)zofs; |
| 19543 | |||
| 19544 | 18 | bgsfx=-1; | |
| 19545 | 18 | mainguy=count_enemy=false; | |
| 19546 | 18 | deadsfx = WAV_EDEAD; | |
| 19547 | 18 | hitsfx = WAV_EHIT; | |
| 19548 | 18 | flags &= ~guy_neverret; | |
| 19549 | 18 | isCore = false; | |
| 19550 | 18 | } | |
| 19551 | |||
| 19552 | 4790 | bool esPatraBS::animate(int32_t index) | |
| 19553 | { | ||
| 19554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4790 times.
|
4790 | if(switch_hooked) return enemy::animate(index); |
| 19555 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 4466 times.
|
4790 | if(dying) |
| 19556 | 324 | return Dead(index); | |
| 19557 | |||
| 19558 | 4466 | return enemy::animate(index); | |
| 19559 | 4790 | } | |
| 19560 | |||
| 19561 | 9580 | void esPatraBS::draw(BITMAP *dest) | |
| 19562 | { | ||
| 19563 | 9580 | tile=o_tile; | |
| 19564 | |||
| 19565 |
1/2✓ Branch 0 taken 9580 times.
✗ Branch 1 not taken.
|
9580 | if(get_bit(quest_rules,qr_NEWENEMYTILES)) |
| 19566 | { | ||
| 19567 |
8/9✓ Branch 0 taken 1280 times.
✓ Branch 1 taken 1326 times.
✓ Branch 2 taken 1076 times.
✓ Branch 3 taken 1254 times.
✓ Branch 4 taken 1080 times.
✓ Branch 5 taken 1238 times.
✓ Branch 6 taken 1146 times.
✓ Branch 7 taken 1180 times.
✗ Branch 8 not taken.
|
9580 | switch(dir) //directions get screwed up after 8. *shrug* |
| 19568 | { | ||
| 19569 | case up: //u | ||
| 19570 | 1280 | flip=0; | |
| 19571 | 1280 | break; | |
| 19572 | |||
| 19573 | case down: //d | ||
| 19574 | 1326 | flip=0; | |
| 19575 | 1326 | tile+=4; | |
| 19576 | 1326 | break; | |
| 19577 | |||
| 19578 | case left: //l | ||
| 19579 | 1076 | flip=0; | |
| 19580 | 1076 | tile+=8; | |
| 19581 | 1076 | break; | |
| 19582 | |||
| 19583 | case right: //r | ||
| 19584 | 1254 | flip=0; | |
| 19585 | 1254 | tile+=12; | |
| 19586 | 1254 | break; | |
| 19587 | |||
| 19588 | case l_up: //ul | ||
| 19589 | 1080 | flip=0; | |
| 19590 | 1080 | tile+=20; | |
| 19591 | 1080 | break; | |
| 19592 | |||
| 19593 | case r_up: //ur | ||
| 19594 | 1238 | flip=0; | |
| 19595 | 1238 | tile+=24; | |
| 19596 | 1238 | break; | |
| 19597 | |||
| 19598 | case l_down: //dl | ||
| 19599 | 1146 | flip=0; | |
| 19600 | 1146 | tile+=28; | |
| 19601 | 1146 | break; | |
| 19602 | |||
| 19603 | case r_down: //dr | ||
| 19604 | 1180 | flip=0; | |
| 19605 | 1180 | tile+=32; | |
| 19606 | 1180 | break; | |
| 19607 | } | ||
| 19608 | |||
| 19609 | 9580 | tile += ((clk&6)>>1); | |
| 19610 | 9580 | } | |
| 19611 | else | ||
| 19612 | { | ||
| 19613 | ✗ | tile += (clk&4)?1:0; | |
| 19614 | } | ||
| 19615 | |||
| 19616 |
2/2✓ Branch 0 taken 972 times.
✓ Branch 1 taken 8608 times.
|
9580 | if(clk>=0) |
| 19617 | 8608 | enemy::draw(dest); | |
| 19618 | 9580 | } | |
| 19619 | |||
| 19620 | |||
| 19621 | /**********************************/ | ||
| 19622 | /********** Misc Code ***********/ | ||
| 19623 | /**********************************/ | ||
| 19624 | |||
| 19625 | 151034 | void addEwpn(int32_t x,int32_t y,int32_t z,int32_t id,int32_t type,int32_t power,int32_t dir, int32_t parentid, byte script_generated, int32_t fakez) | |
| 19626 | { | ||
| 19627 |
4/6✓ Branch 0 taken 116952 times.
✓ Branch 1 taken 34082 times.
✓ Branch 2 taken 116952 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 116952 times.
✗ Branch 5 not taken.
|
151034 | if(id>wEnemyWeapons || (id >= wScript1 && id <= wScript10)) |
| 19628 |
4/8✓ Branch 0 taken 151034 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 151034 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 151034 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 151034 times.
✗ Branch 7 not taken.
|
151034 | Ewpns.add(new weapon((zfix)x,(zfix)y,(zfix)z,id,type,power,dir, -1, parentid, script_generated)); |
| 19629 |
1/2✓ Branch 0 taken 151034 times.
✗ Branch 1 not taken.
|
151034 | if (fakez > 0) ((weapon*)(Ewpns.spr(Ewpns.Count()-1)))->fakez = fakez; |
| 19630 | 151034 | } | |
| 19631 | |||
| 19632 | 34367 | int32_t hit_enemy(int32_t index, int32_t wpnId,int32_t power,int32_t wpnx,int32_t wpny,int32_t dir, int32_t enemyHitWeapon, weapon* realweap) | |
| 19633 | { | ||
| 19634 | // Kludge | ||
| 19635 |
4/8✓ Branch 0 taken 34367 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34367 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 34367 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 34367 times.
✗ Branch 7 not taken.
|
34367 | weapon *w = new weapon((zfix)wpnx,(zfix)wpny,(zfix)0,wpnId,0,power,dir,enemyHitWeapon,-1,false); |
| 19636 | 34367 | int32_t ret = ((enemy*)guys.spr(index))->takehit(w,realweap); | |
| 19637 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34367 times.
|
34367 | delete w; |
| 19638 | 34367 | return ret; | |
| 19639 | ✗ | } | |
| 19640 | |||
| 19641 | 3789 | void enemy_scored(int32_t index) | |
| 19642 | { | ||
| 19643 | 3789 | ((enemy*)guys.spr(index))->scored=true; | |
| 19644 | 3789 | } | |
| 19645 | |||
| 19646 | 1290 | void addguy(int32_t x,int32_t y,int32_t id,int32_t clk,bool mainguy) | |
| 19647 | { | ||
| 19648 |
7/12✓ Branch 0 taken 1290 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1290 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1290 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1290 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 115 times.
✓ Branch 9 taken 1175 times.
✓ Branch 10 taken 1290 times.
✗ Branch 11 not taken.
|
1290 | guy *g = new guy((zfix)x,(zfix)(y+(isdungeon()?1:0)),id,get_bit(quest_rules,qr_NOGUYPOOF)?0:clk,mainguy); |
| 19649 | 1290 | guys.add(g); | |
| 19650 | 1290 | } | |
| 19651 | |||
| 19652 | 21943 | void additem(int32_t x,int32_t y,int32_t id,int32_t pickup) | |
| 19653 | { | ||
| 19654 |
5/10✓ Branch 0 taken 21943 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21943 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21943 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21943 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 21943 times.
✗ Branch 9 not taken.
|
21943 | item *i = new item(zfix(x), zfix(y - get_bit(quest_rules, qr_NOITEMOFFSET)), zfix(0), id, pickup, 0); |
| 19655 | 21943 | items.add(i); | |
| 19656 | 21943 | } | |
| 19657 | |||
| 19658 | 70 | void additem(int32_t x,int32_t y,int32_t id,int32_t pickup,int32_t clk) | |
| 19659 | { | ||
| 19660 |
6/12✓ Branch 0 taken 70 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 70 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 70 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 70 times.
✗ Branch 11 not taken.
|
70 | item *i = new item((zfix)x,(zfix)y-(get_bit(quest_rules, qr_NOITEMOFFSET)),(zfix)0,id,pickup,clk); |
| 19661 | 70 | items.add(i); | |
| 19662 | 70 | } | |
| 19663 | |||
| 19664 | ✗ | void adddummyitem(int32_t x,int32_t y,int32_t id,int32_t pickup) | |
| 19665 | { | ||
| 19666 | ✗ | item *i = new item((zfix)x,(zfix)y-(get_bit(quest_rules, qr_NOITEMOFFSET)),(zfix)0,id,pickup,0,true); | |
| 19667 | ✗ | items.add(i); | |
| 19668 | ✗ | } | |
| 19669 | |||
| 19670 | 58 | void kill_em_all() | |
| 19671 | { | ||
| 19672 |
2/2✓ Branch 0 taken 254 times.
✓ Branch 1 taken 58 times.
|
312 | for(int32_t i=0; i<guys.Count(); i++) |
| 19673 | { | ||
| 19674 | 254 | enemy *e = ((enemy*)guys.spr(i)); | |
| 19675 | |||
| 19676 |
3/6✓ Branch 0 taken 25 times.
✓ Branch 1 taken 229 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 25 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
254 | if(e->flags&(1<<3) && !(e->family == eeGHINI && e->dmisc1 == 1)) continue; |
| 19677 | |||
| 19678 | 229 | e->kickbucket(); | |
| 19679 | 229 | } | |
| 19680 | 58 | } | |
| 19681 | |||
| 19682 | ✗ | bool can_kill_em_all() | |
| 19683 | { | ||
| 19684 | ✗ | for(int32_t i=0; i<guys.Count(); i++) | |
| 19685 | { | ||
| 19686 | ✗ | enemy *e = ((enemy*)guys.spr(i)); | |
| 19687 | |||
| 19688 | ✗ | if(e->flags&(1<<3) && !(e->family == eeGHINI && e->dmisc1 == 1)) continue; | |
| 19689 | ✗ | if(e->superman) continue; | |
| 19690 | ✗ | return true; | |
| 19691 | } | ||
| 19692 | ✗ | return false; | |
| 19693 | ✗ | } | |
| 19694 | |||
| 19695 | //This needs a quest rule, or enemy flag, Dying Enemy Doesn't Hurt Hero | ||
| 19696 | // For Hero's hit detection. Don't count them if they are stunned or are guys. | ||
| 19697 | ✗ | int32_t GuyHit(int32_t tx,int32_t ty,int32_t tz,int32_t txsz,int32_t tysz,int32_t tzsz) | |
| 19698 | { | ||
| 19699 | ✗ | for(int32_t i=0; i<guys.Count(); i++) | |
| 19700 | { | ||
| 19701 | ✗ | if(guys.spr(i)->hit(tx,ty,tz,txsz,tysz,tzsz)) | |
| 19702 | { | ||
| 19703 | ✗ | if(((enemy*)guys.spr(i))->stunclk==0 && ((enemy*)guys.spr(i))->frozenclock==0 && (!get_bit(quest_rules, qr_SAFEENEMYFADE) || ((enemy*)guys.spr(i))->fading != fade_flicker) | |
| 19704 | ✗ | &&(((enemy*)guys.spr(i))->d->family != eeGUY || ((enemy*)guys.spr(i))->dmisc1)) | |
| 19705 | { | ||
| 19706 | ✗ | return i; | |
| 19707 | } | ||
| 19708 | ✗ | } | |
| 19709 | ✗ | } | |
| 19710 | |||
| 19711 | ✗ | return -1; | |
| 19712 | ✗ | } | |
| 19713 | |||
| 19714 | 5922162 | int32_t GuyHitFrom(int32_t index,int32_t tx,int32_t ty,int32_t tz,int32_t txsz,int32_t tysz,int32_t tzsz) | |
| 19715 | { | ||
| 19716 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 5922162 times.
✓ Branch 2 taken 17446707 times.
✓ Branch 3 taken 5908380 times.
|
23355087 | for(int32_t i=zc_max(0, index); i<guys.Count(); i++) |
| 19717 | { | ||
| 19718 |
2/2✓ Branch 0 taken 13782 times.
✓ Branch 1 taken 17432925 times.
|
17446707 | if(guys.spr(i)->hit(tx,ty,tz,txsz,tysz,tzsz)) |
| 19719 | { | ||
| 19720 | 13782 | return i; | |
| 19721 | } | ||
| 19722 | 17432925 | } | |
| 19723 | |||
| 19724 | 5908380 | return -1; | |
| 19725 | 5922162 | } | |
| 19726 | |||
| 19727 | // For Hero's hit detection. Count them if they are dying. | ||
| 19728 | 25716 | int32_t GuyHit(int32_t index,int32_t tx,int32_t ty,int32_t tz,int32_t txsz,int32_t tysz,int32_t tzsz) | |
| 19729 | { | ||
| 19730 | 25716 | enemy *e = (enemy*)guys.spr(index); | |
| 19731 |
3/4✓ Branch 0 taken 25716 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14117 times.
✓ Branch 3 taken 11599 times.
|
25716 | if(!e || e->hp > 0) |
| 19732 | 14117 | return -1; | |
| 19733 | |||
| 19734 | 11599 | bool d = e->dying; | |
| 19735 | 11599 | int32_t hc = e->hclk; | |
| 19736 | 11599 | e->dying = false; | |
| 19737 | 11599 | e->hclk = 0; | |
| 19738 | 11599 | bool hit = e->hit(tx,ty,tz,txsz,tysz,tzsz); | |
| 19739 | 11599 | e->dying = d; | |
| 19740 | 11599 | e->hclk = hc; | |
| 19741 | |||
| 19742 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 11518 times.
|
11599 | return hit ? index : -1; |
| 19743 | 25716 | } | |
| 19744 | |||
| 19745 | 6441870 | bool hasMainGuy() | |
| 19746 | { | ||
| 19747 |
2/2✓ Branch 0 taken 7998898 times.
✓ Branch 1 taken 2319497 times.
|
10318395 | for(int32_t i=0; i<guys.Count(); i++) |
| 19748 | { | ||
| 19749 |
2/2✓ Branch 0 taken 4122373 times.
✓ Branch 1 taken 3876525 times.
|
7998898 | if(((enemy*)guys.spr(i))->mainguy) |
| 19750 | { | ||
| 19751 | 4122373 | return true; | |
| 19752 | } | ||
| 19753 | 3876525 | } | |
| 19754 | |||
| 19755 | 2319497 | return false; | |
| 19756 | 6441870 | } | |
| 19757 | |||
| 19758 | 51 | void EatHero(int32_t index) | |
| 19759 | { | ||
| 19760 | 51 | ((eStalfos*)guys.spr(index))->eathero(); | |
| 19761 | 51 | } | |
| 19762 | |||
| 19763 | 3 | void GrabHero(int32_t index) | |
| 19764 | { | ||
| 19765 | 3 | ((eWallM*)guys.spr(index))->grabhero(); | |
| 19766 | 3 | } | |
| 19767 | |||
| 19768 | 292 | bool CarryHero() | |
| 19769 | { | ||
| 19770 |
1/2✓ Branch 0 taken 891 times.
✗ Branch 1 not taken.
|
891 | for(int32_t i=0; i<guys.Count(); i++) |
| 19771 | { | ||
| 19772 |
2/2✓ Branch 0 taken 536 times.
✓ Branch 1 taken 355 times.
|
891 | if(((guy*)(guys.spr(i)))->family==eeWALLM) |
| 19773 | { | ||
| 19774 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 63 times.
|
355 | if(((eWallM*)guys.spr(i))->hashero) |
| 19775 | { | ||
| 19776 | 292 | Hero.x=guys.spr(i)->x; | |
| 19777 | 292 | Hero.y=guys.spr(i)->y; | |
| 19778 | 292 | return ((eWallM*)guys.spr(i))->misc > 0; | |
| 19779 | } | ||
| 19780 | 63 | } | |
| 19781 | |||
| 19782 | // Like Likes currently can't carry Hero. | ||
| 19783 | /* | ||
| 19784 | if(((guy*)(guys.spr(i)))->family==eeLIKE) | ||
| 19785 | { | ||
| 19786 | if(((eLikeLike*)guys.spr(i))->hashero) | ||
| 19787 | { | ||
| 19788 | Hero.x=guys.spr(i)->x; | ||
| 19789 | Hero.y=guys.spr(i)->y; | ||
| 19790 | return (true); | ||
| 19791 | } | ||
| 19792 | }*/ | ||
| 19793 | 599 | } | |
| 19794 | |||
| 19795 | ✗ | return false; | |
| 19796 | 292 | } | |
| 19797 | |||
| 19798 | // Move item with guy | ||
| 19799 | ✗ | void movefairy(zfix &x,zfix &y,int32_t misc) | |
| 19800 | { | ||
| 19801 | ✗ | int32_t i = guys.idFirst(eITEMFAIRY+0x1000*misc); | |
| 19802 | |||
| 19803 | ✗ | if(i!=-1) | |
| 19804 | { | ||
| 19805 | ✗ | x = guys.spr(i)->x; | |
| 19806 | ✗ | y = guys.spr(i)->y; | |
| 19807 | ✗ | } | |
| 19808 | ✗ | } | |
| 19809 | |||
| 19810 | // Move guy with item (used by FFC scripts and hookshot-dragged fairies) | ||
| 19811 | ✗ | void movefairy2(zfix x,zfix y,int32_t misc) | |
| 19812 | { | ||
| 19813 | ✗ | int32_t i = guys.idFirst(eITEMFAIRY+0x1000*misc); | |
| 19814 | |||
| 19815 | ✗ | if(i!=-1) | |
| 19816 | { | ||
| 19817 | ✗ | guys.spr(i)->x = x; | |
| 19818 | ✗ | guys.spr(i)->y = y; | |
| 19819 | ✗ | } | |
| 19820 | ✗ | }// Move item with guy | |
| 19821 | |||
| 19822 | 32232 | void movefairynew(zfix &x,zfix &y, item const &itemfairy) | |
| 19823 | { | ||
| 19824 | 32232 | enemy *fairy = (enemy *) guys.getByUID(itemfairy.fairyUID); | |
| 19825 | |||
| 19826 |
1/2✓ Branch 0 taken 32232 times.
✗ Branch 1 not taken.
|
32232 | if(fairy) |
| 19827 | { | ||
| 19828 | 32232 | x = fairy->x; | |
| 19829 | 32232 | y = fairy->y; | |
| 19830 | 32232 | } | |
| 19831 | 32232 | } | |
| 19832 | |||
| 19833 | // Move guy with item (used by FFC scripts and hookshot-dragged fairies) | ||
| 19834 | ✗ | void movefairynew2(zfix x,zfix y, item const &itemfairy) | |
| 19835 | { | ||
| 19836 | ✗ | enemy *fairy = (enemy *) guys.getByUID(itemfairy.fairyUID); | |
| 19837 | |||
| 19838 | ✗ | if(fairy) | |
| 19839 | { | ||
| 19840 | ✗ | fairy->x = x; | |
| 19841 | ✗ | fairy->y = y; | |
| 19842 | ✗ | } | |
| 19843 | ✗ | } | |
| 19844 | |||
| 19845 | ✗ | void killfairy(int32_t misc) | |
| 19846 | { | ||
| 19847 | ✗ | int32_t i = guys.idFirst(eITEMFAIRY+0x1000*misc); | |
| 19848 | ✗ | guys.del(i); | |
| 19849 | ✗ | } | |
| 19850 | |||
| 19851 | ✗ | int32_t getGuyIndex(const int32_t eid) | |
| 19852 | { | ||
| 19853 | ✗ | for(word i = 0; i < guys.Count(); i++) | |
| 19854 | { | ||
| 19855 | ✗ | if(guys.spr(i)->getUID() == eid) | |
| 19856 | ✗ | return i; | |
| 19857 | ✗ | } | |
| 19858 | |||
| 19859 | ✗ | return -1; | |
| 19860 | ✗ | } | |
| 19861 | |||
| 19862 | ✗ | void killfairynew(item const &itemfairy) | |
| 19863 | { | ||
| 19864 | ✗ | enemy *fairy = (enemy *) guys.getByUID(itemfairy.fairyUID); | |
| 19865 | ✗ | if (fairy != NULL) guys.del(getGuyIndex(itemfairy.fairyUID)); | |
| 19866 | ✗ | } | |
| 19867 | |||
| 19868 | //Should probably change this to return an 'enemy*', null on failure -Em | ||
| 19869 | 10984 | int32_t addenemy(int32_t x,int32_t y,int32_t id,int32_t clk) | |
| 19870 | { | ||
| 19871 | 10984 | return addenemy(x,y,0,id,clk); | |
| 19872 | } | ||
| 19873 | |||
| 19874 | 868 | int32_t addchild(int32_t x,int32_t y,int32_t id,int32_t clk, int32_t parent_scriptUID) | |
| 19875 | { | ||
| 19876 | 868 | return addchild(x,y,0,id,clk, parent_scriptUID); | |
| 19877 | } | ||
| 19878 | |||
| 19879 | 893 | int32_t addchild(int32_t x,int32_t y,int32_t z,int32_t id,int32_t clk, int32_t parent_scriptUID) | |
| 19880 | { | ||
| 19881 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 893 times.
|
893 | if(id <= 0) return 0; |
| 19882 | |||
| 19883 | 893 | int32_t ret = 0; | |
| 19884 | 893 | sprite *e=NULL; | |
| 19885 | 893 | al_trace("Adding child\n"); | |
| 19886 | |||
| 19887 |
5/31✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 857 times.
✓ Branch 10 taken 15 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 4 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
|
893 | switch(guysbuf[id&0xFFF].family) |
| 19888 | { | ||
| 19889 | //Fixme: possible enemy memory leak. (minor) | ||
| 19890 | case eeWALK: | ||
| 19891 |
3/6✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
16 | e = new eStalfos((zfix)x,(zfix)y,id,clk); |
| 19892 | 16 | break; | |
| 19893 | |||
| 19894 | case eeLEV: | ||
| 19895 | ✗ | e = new eLeever((zfix)x,(zfix)y,id,clk); | |
| 19896 | ✗ | break; | |
| 19897 | |||
| 19898 | case eeTEK: | ||
| 19899 | ✗ | e = new eTektite((zfix)x,(zfix)y,id,clk); | |
| 19900 | ✗ | break; | |
| 19901 | |||
| 19902 | case eePEAHAT: | ||
| 19903 | ✗ | e = new ePeahat((zfix)x,(zfix)y,id,clk); | |
| 19904 | ✗ | break; | |
| 19905 | |||
| 19906 | case eeZORA: | ||
| 19907 | ✗ | e = new eZora((zfix)x,(zfix)y,id,clk); | |
| 19908 | ✗ | break; | |
| 19909 | |||
| 19910 | case eeGHINI: | ||
| 19911 | ✗ | e = new eGhini((zfix)x,(zfix)y,id,clk); | |
| 19912 | ✗ | break; | |
| 19913 | |||
| 19914 | case eeKEESE: | ||
| 19915 |
3/6✓ Branch 0 taken 857 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 857 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 857 times.
✗ Branch 5 not taken.
|
857 | e = new eKeese((zfix)x,(zfix)y,id,clk); |
| 19916 | 857 | break; | |
| 19917 | |||
| 19918 | case eeWIZZ: | ||
| 19919 |
3/6✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
|
15 | e = new eWizzrobe((zfix)x,(zfix)y,id,clk); |
| 19920 | 15 | break; | |
| 19921 | |||
| 19922 | case eePROJECTILE: | ||
| 19923 | ✗ | e = new eProjectile((zfix)x,(zfix)y,id,clk); | |
| 19924 | ✗ | break; | |
| 19925 | |||
| 19926 | case eeWALLM: | ||
| 19927 | ✗ | e = new eWallM((zfix)x,(zfix)y,id,clk); | |
| 19928 | ✗ | break; | |
| 19929 | |||
| 19930 | case eeAQUA: | ||
| 19931 | ✗ | e = new eAquamentus((zfix)x,(zfix)y,id,clk); | |
| 19932 | ✗ | break; | |
| 19933 | |||
| 19934 | case eeMOLD: | ||
| 19935 | ✗ | e = new eMoldorm((zfix)x,(zfix)y,id,zc_max(1,zc_min(254,guysbuf[id&0xFFF].misc1))); | |
| 19936 | ✗ | break; | |
| 19937 | |||
| 19938 | case eeMANHAN: | ||
| 19939 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | e = new eManhandla((zfix)x,(zfix)y,id,clk); |
| 19940 | 1 | break; | |
| 19941 | |||
| 19942 | case eeGLEEOK: | ||
| 19943 | ✗ | e = new eGleeok((zfix)x,(zfix)y,id,zc_max(1,zc_min(254,guysbuf[id&0xFFF].misc1))); | |
| 19944 | ✗ | break; | |
| 19945 | |||
| 19946 | case eeGHOMA: | ||
| 19947 | ✗ | e = new eGohma((zfix)x,(zfix)y,id,clk); | |
| 19948 | ✗ | break; | |
| 19949 | |||
| 19950 | case eeLANM: | ||
| 19951 | ✗ | e = new eLanmola((zfix)x,(zfix)y,id,zc_max(1,zc_min(253,guysbuf[id&0xFFF].misc1))); | |
| 19952 | ✗ | break; | |
| 19953 | |||
| 19954 | case eeGANON: | ||
| 19955 | ✗ | e = new eGanon((zfix)x,(zfix)y,id,clk); | |
| 19956 | ✗ | break; | |
| 19957 | |||
| 19958 | case eeFAIRY: | ||
| 19959 | ✗ | e = new eItemFairy((zfix)x,(zfix)y,id+0x1000*clk,clk); | |
| 19960 | ✗ | break; | |
| 19961 | |||
| 19962 | case eeFIRE: | ||
| 19963 | ✗ | e = new eFire((zfix)x,(zfix)y,id,clk); | |
| 19964 | ✗ | break; | |
| 19965 | |||
| 19966 | case eeOTHER: | ||
| 19967 | ✗ | e = new eOther((zfix)x,(zfix)y,id,clk); | |
| 19968 | ✗ | break; | |
| 19969 | |||
| 19970 | |||
| 19971 | case eeSCRIPT01: | ||
| 19972 | case eeSCRIPT02: | ||
| 19973 | case eeSCRIPT03: | ||
| 19974 | case eeSCRIPT04: | ||
| 19975 | case eeSCRIPT05: | ||
| 19976 | case eeSCRIPT06: | ||
| 19977 | case eeSCRIPT07: | ||
| 19978 | case eeSCRIPT08: | ||
| 19979 | case eeSCRIPT09: | ||
| 19980 | case eeSCRIPT10: | ||
| 19981 | case eeSCRIPT11: | ||
| 19982 | case eeSCRIPT12: | ||
| 19983 | case eeSCRIPT13: | ||
| 19984 | case eeSCRIPT14: | ||
| 19985 | case eeSCRIPT15: | ||
| 19986 | case eeSCRIPT16: | ||
| 19987 | case eeSCRIPT17: | ||
| 19988 | case eeSCRIPT18: | ||
| 19989 | case eeSCRIPT19: | ||
| 19990 | case eeSCRIPT20: | ||
| 19991 | { | ||
| 19992 | ✗ | if ( !get_bit(quest_rules, qr_SCRIPT_FRIENDLY_ENEMY_TYPES) ) | |
| 19993 | { | ||
| 19994 | ✗ | e = new eScript((zfix)x,(zfix)y,id,clk); | |
| 19995 | ✗ | break; | |
| 19996 | } | ||
| 19997 | ✗ | else return 0; | |
| 19998 | } | ||
| 19999 | |||
| 20000 | case eeFFRIENDLY01: | ||
| 20001 | case eeFFRIENDLY02: | ||
| 20002 | case eeFFRIENDLY03: | ||
| 20003 | case eeFFRIENDLY04: | ||
| 20004 | case eeFFRIENDLY05: | ||
| 20005 | case eeFFRIENDLY06: | ||
| 20006 | case eeFFRIENDLY07: | ||
| 20007 | case eeFFRIENDLY08: | ||
| 20008 | case eeFFRIENDLY09: | ||
| 20009 | case eeFFRIENDLY10: | ||
| 20010 | { | ||
| 20011 | ✗ | if ( !get_bit(quest_rules, qr_SCRIPT_FRIENDLY_ENEMY_TYPES) ) | |
| 20012 | { | ||
| 20013 | ✗ | e = new eFriendly((zfix)x,(zfix)y,id,clk); break; | |
| 20014 | } | ||
| 20015 | ✗ | else return 0; | |
| 20016 | |||
| 20017 | } | ||
| 20018 | |||
| 20019 | case eeSPINTILE: | ||
| 20020 | ✗ | e = new eSpinTile((zfix)x,(zfix)y,id,clk); | |
| 20021 | ✗ | break; | |
| 20022 | |||
| 20023 | // and these enemies use the misc10/misc2 value | ||
| 20024 | case eeROCK: | ||
| 20025 | { | ||
| 20026 | ✗ | switch(guysbuf[id&0xFFF].misc10) | |
| 20027 | { | ||
| 20028 | case 1: | ||
| 20029 | ✗ | e = new eBoulder((zfix)x,(zfix)y,id,clk); | |
| 20030 | ✗ | break; | |
| 20031 | |||
| 20032 | ✗ | case 0: | |
| 20033 | default: | ||
| 20034 | ✗ | e = new eRock((zfix)x,(zfix)y,id,clk); | |
| 20035 | ✗ | break; | |
| 20036 | } | ||
| 20037 | |||
| 20038 | ✗ | break; | |
| 20039 | } | ||
| 20040 | |||
| 20041 | case eeTRAP: | ||
| 20042 | { | ||
| 20043 | ✗ | switch(guysbuf[id&0xFFF].misc2) | |
| 20044 | { | ||
| 20045 | case 1: | ||
| 20046 | ✗ | e = new eTrap2((zfix)x,(zfix)y,id,clk); | |
| 20047 | ✗ | break; | |
| 20048 | |||
| 20049 | ✗ | case 0: | |
| 20050 | default: | ||
| 20051 | ✗ | e = new eTrap((zfix)x,(zfix)y,id,clk); | |
| 20052 | ✗ | break; | |
| 20053 | } | ||
| 20054 | |||
| 20055 | ✗ | break; | |
| 20056 | } | ||
| 20057 | |||
| 20058 | case eeDONGO: | ||
| 20059 | { | ||
| 20060 | ✗ | switch(guysbuf[id&0xFFF].misc10) | |
| 20061 | { | ||
| 20062 | case 1: | ||
| 20063 | ✗ | e = new eDodongo2((zfix)x,(zfix)y,id,clk); | |
| 20064 | ✗ | break; | |
| 20065 | |||
| 20066 | ✗ | case 0: | |
| 20067 | default: | ||
| 20068 | ✗ | e = new eDodongo((zfix)x,(zfix)y,id,clk); | |
| 20069 | ✗ | break; | |
| 20070 | } | ||
| 20071 | |||
| 20072 | ✗ | break; | |
| 20073 | } | ||
| 20074 | |||
| 20075 | case eeDIG: | ||
| 20076 | { | ||
| 20077 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
4 | switch(guysbuf[id&0xFFF].misc10) |
| 20078 | { | ||
| 20079 | case 1: | ||
| 20080 | ✗ | e = new eLilDig((zfix)x,(zfix)y,id,clk); | |
| 20081 | ✗ | break; | |
| 20082 | |||
| 20083 | 4 | case 0: | |
| 20084 | default: | ||
| 20085 |
3/6✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
4 | e = new eBigDig((zfix)x,(zfix)y,id,clk); |
| 20086 | 4 | break; | |
| 20087 | } | ||
| 20088 | |||
| 20089 | 4 | break; | |
| 20090 | } | ||
| 20091 | |||
| 20092 | case eePATRA: | ||
| 20093 | { | ||
| 20094 | ✗ | switch(guysbuf[id&0xFFF].misc10) | |
| 20095 | { | ||
| 20096 | case 1: | ||
| 20097 | ✗ | if (get_bit(quest_rules,qr_HARDCODED_BS_PATRA)) | |
| 20098 | { | ||
| 20099 | ✗ | e = new ePatraBS((zfix)x,(zfix)y,id,clk); | |
| 20100 | ✗ | break; | |
| 20101 | } | ||
| 20102 | [[fallthrough]]; | ||
| 20103 | ✗ | case 0: | |
| 20104 | default: | ||
| 20105 | ✗ | e = new ePatra((zfix)x,(zfix)y,id,clk); | |
| 20106 | ✗ | break; | |
| 20107 | } | ||
| 20108 | |||
| 20109 | ✗ | break; | |
| 20110 | } | ||
| 20111 | |||
| 20112 | case eeGUY: | ||
| 20113 | { | ||
| 20114 | ✗ | switch(guysbuf[id&0xFFF].misc10) | |
| 20115 | { | ||
| 20116 | case 1: | ||
| 20117 | ✗ | e = new eTrigger((zfix)x,(zfix)y,id,clk); | |
| 20118 | ✗ | break; | |
| 20119 | |||
| 20120 | ✗ | case 0: | |
| 20121 | default: | ||
| 20122 | ✗ | e = new eNPC((zfix)x,(zfix)y,id,clk); | |
| 20123 | ✗ | break; | |
| 20124 | } | ||
| 20125 | |||
| 20126 | ✗ | break; | |
| 20127 | } | ||
| 20128 | |||
| 20129 | case eeNONE: | ||
| 20130 | ✗ | if(guysbuf[id&0xFFF].misc10 ==1) | |
| 20131 | { | ||
| 20132 | ✗ | e = new eTrigger((zfix)x,(zfix)y,id,clk); | |
| 20133 | ✗ | break; | |
| 20134 | break; | ||
| 20135 | } | ||
| 20136 | [[fallthrough]]; | ||
| 20137 | default: | ||
| 20138 | |||
| 20139 | ✗ | return 0; | |
| 20140 | } | ||
| 20141 | |||
| 20142 | 893 | ret++; // Made one enemy. | |
| 20143 | |||
| 20144 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 893 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
893 | if(z && canfall(id)) |
| 20145 | { | ||
| 20146 | ✗ | e->z = (zfix)z; | |
| 20147 | ✗ | } | |
| 20148 | |||
| 20149 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 893 times.
|
893 | ((enemy*)e)->ceiling = (z && canfall(id)); |
| 20150 | 893 | ((enemy*)e)->parent_script_UID = parent_scriptUID; | |
| 20151 | //al_trace("Child Script UID: %d\n",((enemy*)e)->script_UID); | ||
| 20152 | //zprint2("Child Script UID: %d\n",((enemy*)e)->script_UID); | ||
| 20153 | //al_trace("Child's Parent UID: %d\n",((enemy*)e)->parent_script_UID); | ||
| 20154 | //zprint2("Child's Parent UID: %d\n",((enemy*)e)->parent_script_UID); | ||
| 20155 | |||
| 20156 | |||
| 20157 |
1/2✓ Branch 0 taken 893 times.
✗ Branch 1 not taken.
|
893 | if(!guys.add(e)) |
| 20158 | { | ||
| 20159 | ✗ | return 0; | |
| 20160 | } | ||
| 20161 | |||
| 20162 | // add segments of segmented enemies | ||
| 20163 | 893 | int32_t c=0; | |
| 20164 | |||
| 20165 |
2/6✓ Branch 0 taken 892 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
893 | switch(guysbuf[id&0xFFF].family) |
| 20166 | { | ||
| 20167 | case eeMOLD: | ||
| 20168 | { | ||
| 20169 | ✗ | byte is=((enemy*)guys.spr(guys.Count()-1))->item_set; | |
| 20170 | ✗ | id &= 0xFFF; | |
| 20171 | |||
| 20172 | ✗ | for(int32_t i=0; i<zc_max(1,zc_min(254,guysbuf[id].misc1)); i++) | |
| 20173 | { | ||
| 20174 | //christ this is messy -DD | ||
| 20175 | ✗ | int32_t segclk = -i*((int32_t)(8.0/(zslongToFix(guysbuf[id&0xFFF].step*100)))); | |
| 20176 | |||
| 20177 | ✗ | if(!guys.add(new esMoldorm((zfix)x,(zfix)y,id+0x1000,segclk))) | |
| 20178 | { | ||
| 20179 | ✗ | al_trace("Moldorm segment %d could not be created!\n",i+1); | |
| 20180 | |||
| 20181 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20182 | ✗ | guys.del(guys.Count()-1); | |
| 20183 | |||
| 20184 | ✗ | return 0; | |
| 20185 | } | ||
| 20186 | |||
| 20187 | ✗ | if(i>0) | |
| 20188 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->item_set=is; | |
| 20189 | |||
| 20190 | ✗ | ret++; | |
| 20191 | ✗ | } | |
| 20192 | |||
| 20193 | ✗ | break; | |
| 20194 | } | ||
| 20195 | |||
| 20196 | case eeLANM: | ||
| 20197 | { | ||
| 20198 | ✗ | id &= 0xFFF; | |
| 20199 | ✗ | int32_t shft = guysbuf[id].misc2; | |
| 20200 | ✗ | byte is=((enemy*)guys.spr(guys.Count()-1))->item_set; | |
| 20201 | |||
| 20202 | ✗ | if(!guys.add(new esLanmola((zfix)x,(zfix)y,id+0x1000,0))) | |
| 20203 | { | ||
| 20204 | ✗ | al_trace("Lanmola segment 1 could not be created!\n"); | |
| 20205 | ✗ | guys.del(guys.Count()-1); | |
| 20206 | ✗ | return 0; | |
| 20207 | } | ||
| 20208 | |||
| 20209 | ✗ | ret++; | |
| 20210 | |||
| 20211 | ✗ | for(int32_t i=1; i<zc_max(1,zc_min(253,guysbuf[id&0xFFF].misc1)); i++) | |
| 20212 | { | ||
| 20213 | ✗ | if(!guys.add(new esLanmola((zfix)x,(zfix)y,id+0x2000,-(i<<shft)))) | |
| 20214 | { | ||
| 20215 | ✗ | al_trace("Lanmola segment %d could not be created!\n",i+1); | |
| 20216 | |||
| 20217 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20218 | ✗ | guys.del(guys.Count()-1); | |
| 20219 | |||
| 20220 | ✗ | return 0; | |
| 20221 | } | ||
| 20222 | |||
| 20223 | ✗ | ((enemy*)guys.spr(guys.Count()-1))->item_set=is; | |
| 20224 | ✗ | ret++; | |
| 20225 | ✗ | } | |
| 20226 | } | ||
| 20227 | ✗ | break; | |
| 20228 | |||
| 20229 | case eeMANHAN: | ||
| 20230 | 1 | id &= 0xFFF; | |
| 20231 | |||
| 20232 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
|
5 | for(int32_t i=0; i<((!(guysbuf[id].misc2))?4:8); i++) |
| 20233 | { | ||
| 20234 |
4/8✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
4 | if(!guys.add(new esManhandla((zfix)x,(zfix)y,id+0x1000,i))) |
| 20235 | { | ||
| 20236 | ✗ | al_trace("Manhandla head %d could not be created!\n",i+1); | |
| 20237 | |||
| 20238 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20239 | { | ||
| 20240 | ✗ | guys.del(guys.Count()-1); | |
| 20241 | ✗ | } | |
| 20242 | |||
| 20243 | ✗ | return 0; | |
| 20244 | } | ||
| 20245 | |||
| 20246 | 4 | ret++; | |
| 20247 | 4 | ((enemy*)guys.spr(guys.Count()-1))->frate=guysbuf[id].misc1; | |
| 20248 | 4 | } | |
| 20249 | |||
| 20250 | 1 | break; | |
| 20251 | |||
| 20252 | case eeGLEEOK: | ||
| 20253 | { | ||
| 20254 | ✗ | id &= 0xFFF; | |
| 20255 | |||
| 20256 | ✗ | for(int32_t i=0; i<zc_max(1,zc_min(254,guysbuf[id&0xFFF].misc1)); i++) | |
| 20257 | { | ||
| 20258 | ✗ | if(!guys.add(new esGleeok((zfix)x,(zfix)y,id+0x1000,c, e))) | |
| 20259 | { | ||
| 20260 | ✗ | al_trace("Gleeok head %d could not be created!\n",i+1); | |
| 20261 | |||
| 20262 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20263 | { | ||
| 20264 | ✗ | guys.del(guys.Count()-1); | |
| 20265 | ✗ | } | |
| 20266 | |||
| 20267 | ✗ | return false; | |
| 20268 | } | ||
| 20269 | |||
| 20270 | ✗ | c-=guysbuf[id].misc4; | |
| 20271 | ✗ | ret++; | |
| 20272 | ✗ | } | |
| 20273 | } | ||
| 20274 | ✗ | break; | |
| 20275 | |||
| 20276 | |||
| 20277 | case eePATRA: | ||
| 20278 | { | ||
| 20279 | ✗ | id &= 0xFFF; | |
| 20280 | ✗ | int32_t outeyes = 0; | |
| 20281 | |||
| 20282 | ✗ | for(int32_t i=0; i<zc_min(254,guysbuf[id&0xFFF].misc1); i++) | |
| 20283 | { | ||
| 20284 | ✗ | if(!((guysbuf[id].misc10&&get_bit(quest_rules,qr_HARDCODED_BS_PATRA))?guys.add(new esPatraBS((zfix)x,(zfix)y,id+0x1000,i,e)):guys.add(new esPatra((zfix)x,(zfix)y,id+0x1000,i,e)))) | |
| 20285 | { | ||
| 20286 | ✗ | al_trace("Patra outer eye %d could not be created!\n",i+1); | |
| 20287 | |||
| 20288 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20289 | ✗ | guys.del(guys.Count()-1); | |
| 20290 | |||
| 20291 | ✗ | return 0; | |
| 20292 | } | ||
| 20293 | else | ||
| 20294 | ✗ | outeyes++; | |
| 20295 | |||
| 20296 | ✗ | ret++; | |
| 20297 | ✗ | } | |
| 20298 | |||
| 20299 | ✗ | for(int32_t i=0; i<zc_min(254,guysbuf[id&0xFFF].misc2); i++) | |
| 20300 | { | ||
| 20301 | ✗ | if(!guys.add(new esPatra((zfix)x,(zfix)y,id+0x1000,i,e))) | |
| 20302 | { | ||
| 20303 | ✗ | al_trace("Patra inner eye %d could not be created!\n",i+1); | |
| 20304 | |||
| 20305 | ✗ | for(int32_t j=0; j<i+1+zc_min(254,outeyes); j++) | |
| 20306 | ✗ | guys.del(guys.Count()-1); | |
| 20307 | |||
| 20308 | ✗ | return 0; | |
| 20309 | } | ||
| 20310 | |||
| 20311 | ✗ | ret++; | |
| 20312 | ✗ | } | |
| 20313 | |||
| 20314 | ✗ | break; | |
| 20315 | } | ||
| 20316 | } | ||
| 20317 | |||
| 20318 | 893 | return ret; | |
| 20319 | 893 | } | |
| 20320 | |||
| 20321 | // Returns number of enemies/segments created | ||
| 20322 | 43816 | int32_t addenemy(int32_t x,int32_t y,int32_t z,int32_t id,int32_t clk) | |
| 20323 | { | ||
| 20324 | //zprint2("addenemy id is: %d\n", (id&0xFFF)); | ||
| 20325 | 43816 | int32_t realid = id&0xFFF; | |
| 20326 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43816 times.
|
43816 | if( realid > MAXGUYS ) |
| 20327 | { | ||
| 20328 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "addenemy()"); | ||
| 20329 | ✗ | return 0; | |
| 20330 | } | ||
| 20331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43816 times.
|
43816 | if(id <= 0) return 0; |
| 20332 | |||
| 20333 | 43816 | int32_t ret = 0; | |
| 20334 | 43816 | sprite *e=NULL; | |
| 20335 | |||
| 20336 |
27/31✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23145 times.
✓ Branch 4 taken 1694 times.
✓ Branch 5 taken 2388 times.
✓ Branch 6 taken 865 times.
✓ Branch 7 taken 1537 times.
✓ Branch 8 taken 139 times.
✓ Branch 9 taken 4734 times.
✓ Branch 10 taken 2081 times.
✓ Branch 11 taken 2127 times.
✓ Branch 12 taken 469 times.
✓ Branch 13 taken 74 times.
✓ Branch 14 taken 85 times.
✓ Branch 15 taken 57 times.
✓ Branch 16 taken 88 times.
✓ Branch 17 taken 54 times.
✓ Branch 18 taken 239 times.
✓ Branch 19 taken 9 times.
✓ Branch 20 taken 383 times.
✓ Branch 21 taken 227 times.
✓ Branch 22 taken 1785 times.
✓ Branch 23 taken 94 times.
✓ Branch 24 taken 238 times.
✓ Branch 25 taken 843 times.
✓ Branch 26 taken 137 times.
✓ Branch 27 taken 246 times.
✓ Branch 28 taken 55 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 23 times.
|
43816 | switch(guysbuf[id&0xFFF].family) |
| 20337 | { | ||
| 20338 | //Fixme: possible enemy memory leak. (minor) | ||
| 20339 | case eeWALK: | ||
| 20340 |
3/6✓ Branch 0 taken 23145 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23145 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 23145 times.
✗ Branch 5 not taken.
|
23145 | e = new eStalfos((zfix)x,(zfix)y,id,clk); |
| 20341 | 23145 | break; | |
| 20342 | |||
| 20343 | case eeLEV: | ||
| 20344 |
3/6✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1694 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1694 times.
✗ Branch 5 not taken.
|
1694 | e = new eLeever((zfix)x,(zfix)y,id,clk); |
| 20345 | 1694 | break; | |
| 20346 | |||
| 20347 | case eeTEK: | ||
| 20348 |
3/6✓ Branch 0 taken 2388 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2388 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2388 times.
✗ Branch 5 not taken.
|
2388 | e = new eTektite((zfix)x,(zfix)y,id,clk); |
| 20349 | 2388 | break; | |
| 20350 | |||
| 20351 | case eePEAHAT: | ||
| 20352 |
3/6✓ Branch 0 taken 865 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 865 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 865 times.
✗ Branch 5 not taken.
|
865 | e = new ePeahat((zfix)x,(zfix)y,id,clk); |
| 20353 | 865 | break; | |
| 20354 | |||
| 20355 | case eeZORA: | ||
| 20356 |
3/6✓ Branch 0 taken 1537 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1537 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1537 times.
✗ Branch 5 not taken.
|
1537 | e = new eZora((zfix)x,(zfix)y,id,clk); |
| 20357 | 1537 | break; | |
| 20358 | |||
| 20359 | case eeGHINI: | ||
| 20360 |
3/6✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 139 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 139 times.
✗ Branch 5 not taken.
|
139 | e = new eGhini((zfix)x,(zfix)y,id,clk); |
| 20361 | 139 | break; | |
| 20362 | |||
| 20363 | case eeKEESE: | ||
| 20364 |
3/6✓ Branch 0 taken 4734 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4734 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4734 times.
✗ Branch 5 not taken.
|
4734 | e = new eKeese((zfix)x,(zfix)y,id,clk); |
| 20365 | 4734 | break; | |
| 20366 | |||
| 20367 | case eeWIZZ: | ||
| 20368 |
3/6✓ Branch 0 taken 2081 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2081 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2081 times.
✗ Branch 5 not taken.
|
2081 | e = new eWizzrobe((zfix)x,(zfix)y,id,clk); |
| 20369 | 2081 | break; | |
| 20370 | |||
| 20371 | case eePROJECTILE: | ||
| 20372 |
3/6✓ Branch 0 taken 2127 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2127 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2127 times.
✗ Branch 5 not taken.
|
2127 | e = new eProjectile((zfix)x,(zfix)y,id,clk); |
| 20373 | 2127 | break; | |
| 20374 | |||
| 20375 | case eeWALLM: | ||
| 20376 |
3/6✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 469 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 469 times.
✗ Branch 5 not taken.
|
469 | e = new eWallM((zfix)x,(zfix)y,id,clk); |
| 20377 | 469 | break; | |
| 20378 | |||
| 20379 | case eeAQUA: | ||
| 20380 |
3/6✓ Branch 0 taken 74 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 74 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 74 times.
✗ Branch 5 not taken.
|
74 | e = new eAquamentus((zfix)x,(zfix)y,id,clk); |
| 20381 | 74 | break; | |
| 20382 | |||
| 20383 | case eeMOLD: | ||
| 20384 |
6/12✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 85 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 85 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 85 times.
✓ Branch 10 taken 85 times.
✗ Branch 11 not taken.
|
85 | e = new eMoldorm((zfix)x,(zfix)y,id,zc_max(1,zc_min(254,guysbuf[id&0xFFF].misc1))); |
| 20385 | 85 | break; | |
| 20386 | |||
| 20387 | case eeMANHAN: | ||
| 20388 |
3/6✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 57 times.
✗ Branch 5 not taken.
|
57 | e = new eManhandla((zfix)x,(zfix)y,id,clk); |
| 20389 | 57 | break; | |
| 20390 | |||
| 20391 | case eeGLEEOK: | ||
| 20392 |
6/12✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 88 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 88 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 88 times.
✓ Branch 10 taken 88 times.
✗ Branch 11 not taken.
|
88 | e = new eGleeok((zfix)x,(zfix)y,id,zc_max(1,zc_min(254,guysbuf[id&0xFFF].misc1))); |
| 20393 | 88 | break; | |
| 20394 | |||
| 20395 | case eeGHOMA: | ||
| 20396 |
3/6✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 54 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 54 times.
✗ Branch 5 not taken.
|
54 | e = new eGohma((zfix)x,(zfix)y,id,clk); |
| 20397 | 54 | break; | |
| 20398 | |||
| 20399 | case eeLANM: | ||
| 20400 |
6/12✓ Branch 0 taken 239 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 239 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 239 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 239 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 239 times.
✓ Branch 10 taken 239 times.
✗ Branch 11 not taken.
|
239 | e = new eLanmola((zfix)x,(zfix)y,id,zc_max(1,zc_min(253,guysbuf[id&0xFFF].misc1))); |
| 20401 | 239 | break; | |
| 20402 | |||
| 20403 | case eeGANON: | ||
| 20404 |
3/6✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | e = new eGanon((zfix)x,(zfix)y,id,clk); |
| 20405 | 9 | break; | |
| 20406 | |||
| 20407 | case eeFAIRY: | ||
| 20408 |
3/6✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 383 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 383 times.
✗ Branch 5 not taken.
|
383 | e = new eItemFairy((zfix)x,(zfix)y,id+0x1000*clk,clk); |
| 20409 | 383 | break; | |
| 20410 | |||
| 20411 | case eeFIRE: | ||
| 20412 |
3/6✓ Branch 0 taken 227 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 227 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 227 times.
✗ Branch 5 not taken.
|
227 | e = new eFire((zfix)x,(zfix)y,id,clk); |
| 20413 | 227 | break; | |
| 20414 | |||
| 20415 | case eeOTHER: | ||
| 20416 |
3/6✓ Branch 0 taken 1785 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1785 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1785 times.
✗ Branch 5 not taken.
|
1785 | e = new eOther((zfix)x,(zfix)y,id,clk); |
| 20417 | 1785 | break; | |
| 20418 | |||
| 20419 | |||
| 20420 | case eeSCRIPT01: | ||
| 20421 | case eeSCRIPT02: | ||
| 20422 | case eeSCRIPT03: | ||
| 20423 | case eeSCRIPT04: | ||
| 20424 | case eeSCRIPT05: | ||
| 20425 | case eeSCRIPT06: | ||
| 20426 | case eeSCRIPT07: | ||
| 20427 | case eeSCRIPT08: | ||
| 20428 | case eeSCRIPT09: | ||
| 20429 | case eeSCRIPT10: | ||
| 20430 | case eeSCRIPT11: | ||
| 20431 | case eeSCRIPT12: | ||
| 20432 | case eeSCRIPT13: | ||
| 20433 | case eeSCRIPT14: | ||
| 20434 | case eeSCRIPT15: | ||
| 20435 | case eeSCRIPT16: | ||
| 20436 | case eeSCRIPT17: | ||
| 20437 | case eeSCRIPT18: | ||
| 20438 | case eeSCRIPT19: | ||
| 20439 | case eeSCRIPT20: | ||
| 20440 | { | ||
| 20441 | ✗ | if ( !get_bit(quest_rules, qr_SCRIPT_FRIENDLY_ENEMY_TYPES) ) | |
| 20442 | { | ||
| 20443 | ✗ | e = new eScript((zfix)x,(zfix)y,id,clk); | |
| 20444 | ✗ | break; | |
| 20445 | } | ||
| 20446 | ✗ | else return 0; | |
| 20447 | } | ||
| 20448 | |||
| 20449 | case eeFFRIENDLY01: | ||
| 20450 | case eeFFRIENDLY02: | ||
| 20451 | case eeFFRIENDLY03: | ||
| 20452 | case eeFFRIENDLY04: | ||
| 20453 | case eeFFRIENDLY05: | ||
| 20454 | case eeFFRIENDLY06: | ||
| 20455 | case eeFFRIENDLY07: | ||
| 20456 | case eeFFRIENDLY08: | ||
| 20457 | case eeFFRIENDLY09: | ||
| 20458 | case eeFFRIENDLY10: | ||
| 20459 | { | ||
| 20460 | ✗ | if ( !get_bit(quest_rules, qr_SCRIPT_FRIENDLY_ENEMY_TYPES) ) | |
| 20461 | { | ||
| 20462 | ✗ | e = new eFriendly((zfix)x,(zfix)y,id,clk); break; | |
| 20463 | } | ||
| 20464 | ✗ | else return 0; | |
| 20465 | |||
| 20466 | } | ||
| 20467 | |||
| 20468 | case eeSPINTILE: | ||
| 20469 |
3/6✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 94 times.
✗ Branch 5 not taken.
|
94 | e = new eSpinTile((zfix)x,(zfix)y,id,clk); |
| 20470 | 94 | break; | |
| 20471 | |||
| 20472 | // and these enemies use the misc10/misc2 value | ||
| 20473 | case eeROCK: | ||
| 20474 | { | ||
| 20475 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✓ Branch 2 taken 208 times.
|
238 | switch(guysbuf[id&0xFFF].misc10) |
| 20476 | { | ||
| 20477 | case 1: | ||
| 20478 |
3/6✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 30 times.
✗ Branch 5 not taken.
|
30 | e = new eBoulder((zfix)x,(zfix)y,id,clk); |
| 20479 | 30 | break; | |
| 20480 | |||
| 20481 | 208 | case 0: | |
| 20482 | default: | ||
| 20483 |
3/6✓ Branch 0 taken 208 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 208 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 208 times.
✗ Branch 5 not taken.
|
208 | e = new eRock((zfix)x,(zfix)y,id,clk); |
| 20484 | 208 | break; | |
| 20485 | } | ||
| 20486 | |||
| 20487 | 238 | break; | |
| 20488 | } | ||
| 20489 | |||
| 20490 | case eeTRAP: | ||
| 20491 | { | ||
| 20492 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✓ Branch 2 taken 703 times.
|
843 | switch(guysbuf[id&0xFFF].misc2) |
| 20493 | { | ||
| 20494 | case 1: | ||
| 20495 |
3/6✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 140 times.
✗ Branch 5 not taken.
|
140 | e = new eTrap2((zfix)x,(zfix)y,id,clk); |
| 20496 | 140 | break; | |
| 20497 | |||
| 20498 | 703 | case 0: | |
| 20499 | default: | ||
| 20500 |
3/6✓ Branch 0 taken 703 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 703 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 703 times.
✗ Branch 5 not taken.
|
703 | e = new eTrap((zfix)x,(zfix)y,id,clk); |
| 20501 | 703 | break; | |
| 20502 | } | ||
| 20503 | |||
| 20504 | 843 | break; | |
| 20505 | } | ||
| 20506 | |||
| 20507 | case eeDONGO: | ||
| 20508 | { | ||
| 20509 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 135 times.
|
137 | switch(guysbuf[id&0xFFF].misc10) |
| 20510 | { | ||
| 20511 | case 1: | ||
| 20512 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | e = new eDodongo2((zfix)x,(zfix)y,id,clk); |
| 20513 | 2 | break; | |
| 20514 | |||
| 20515 | 135 | case 0: | |
| 20516 | default: | ||
| 20517 |
3/6✓ Branch 0 taken 135 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 135 times.
✗ Branch 5 not taken.
|
135 | e = new eDodongo((zfix)x,(zfix)y,id,clk); |
| 20518 | 135 | break; | |
| 20519 | } | ||
| 20520 | |||
| 20521 | 137 | break; | |
| 20522 | } | ||
| 20523 | |||
| 20524 | case eeDIG: | ||
| 20525 | { | ||
| 20526 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 198 times.
✓ Branch 2 taken 48 times.
|
246 | switch(guysbuf[id&0xFFF].misc10) |
| 20527 | { | ||
| 20528 | case 1: | ||
| 20529 |
3/6✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 198 times.
✗ Branch 5 not taken.
|
198 | e = new eLilDig((zfix)x,(zfix)y,id,clk); |
| 20530 | 198 | break; | |
| 20531 | |||
| 20532 | 48 | case 0: | |
| 20533 | default: | ||
| 20534 |
3/6✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 48 times.
✗ Branch 5 not taken.
|
48 | e = new eBigDig((zfix)x,(zfix)y,id,clk); |
| 20535 | 48 | break; | |
| 20536 | } | ||
| 20537 | |||
| 20538 | 246 | break; | |
| 20539 | } | ||
| 20540 | |||
| 20541 | case eePATRA: | ||
| 20542 | { | ||
| 20543 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 3 times.
|
55 | switch(guysbuf[id&0xFFF].misc10) |
| 20544 | { | ||
| 20545 | case 1: | ||
| 20546 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (get_bit(quest_rules,qr_HARDCODED_BS_PATRA)) |
| 20547 | { | ||
| 20548 |
3/6✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | e = new ePatraBS((zfix)x,(zfix)y,id,clk); |
| 20549 | 3 | break; | |
| 20550 | } | ||
| 20551 | [[fallthrough]]; | ||
| 20552 | 52 | case 0: | |
| 20553 | default: | ||
| 20554 |
3/6✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
|
52 | e = new ePatra((zfix)x,(zfix)y,id,clk); |
| 20555 | 52 | break; | |
| 20556 | } | ||
| 20557 | |||
| 20558 | 55 | break; | |
| 20559 | } | ||
| 20560 | |||
| 20561 | case eeGUY: | ||
| 20562 | { | ||
| 20563 | ✗ | switch(guysbuf[id&0xFFF].misc10) | |
| 20564 | { | ||
| 20565 | case 1: | ||
| 20566 | ✗ | e = new eTrigger((zfix)x,(zfix)y,id,clk); | |
| 20567 | ✗ | break; | |
| 20568 | |||
| 20569 | ✗ | case 0: | |
| 20570 | default: | ||
| 20571 | ✗ | e = new eNPC((zfix)x,(zfix)y,id,clk); | |
| 20572 | ✗ | break; | |
| 20573 | } | ||
| 20574 | |||
| 20575 | ✗ | break; | |
| 20576 | } | ||
| 20577 | |||
| 20578 | case eeNONE: | ||
| 20579 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | if(guysbuf[id&0xFFF].misc10 ==1) |
| 20580 | { | ||
| 20581 |
3/6✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 23 times.
✗ Branch 5 not taken.
|
23 | e = new eTrigger((zfix)x,(zfix)y,id,clk); |
| 20582 | 23 | break; | |
| 20583 | break; | ||
| 20584 | } | ||
| 20585 | [[fallthrough]]; | ||
| 20586 | default: | ||
| 20587 | |||
| 20588 | ✗ | return 0; | |
| 20589 | } | ||
| 20590 | |||
| 20591 | 43816 | ret++; // Made one enemy. | |
| 20592 | |||
| 20593 |
4/4✓ Branch 0 taken 83 times.
✓ Branch 1 taken 43733 times.
✓ Branch 2 taken 24 times.
✓ Branch 3 taken 59 times.
|
43816 | if(z && canfall(id)) |
| 20594 | { | ||
| 20595 | 59 | e->z = (zfix)z; | |
| 20596 | 59 | } | |
| 20597 | |||
| 20598 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 43733 times.
|
43816 | ((enemy*)e)->ceiling = (z && canfall(id)); |
| 20599 | |||
| 20600 |
1/2✓ Branch 0 taken 43816 times.
✗ Branch 1 not taken.
|
43816 | if(!guys.add(e)) |
| 20601 | { | ||
| 20602 | ✗ | return 0; | |
| 20603 | } | ||
| 20604 | |||
| 20605 | // add segments of segmented enemies | ||
| 20606 | 43816 | int32_t c=0; | |
| 20607 | |||
| 20608 |
6/6✓ Branch 0 taken 43292 times.
✓ Branch 1 taken 85 times.
✓ Branch 2 taken 239 times.
✓ Branch 3 taken 57 times.
✓ Branch 4 taken 88 times.
✓ Branch 5 taken 55 times.
|
43816 | switch(guysbuf[id&0xFFF].family) |
| 20609 | { | ||
| 20610 | case eeMOLD: | ||
| 20611 | { | ||
| 20612 | 85 | byte is=((enemy*)guys.spr(guys.Count()-1))->item_set; | |
| 20613 | 85 | id &= 0xFFF; | |
| 20614 | |||
| 20615 |
5/8✗ Branch 0 not taken.
✓ Branch 1 taken 570 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 570 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 570 times.
✓ Branch 6 taken 485 times.
✓ Branch 7 taken 85 times.
|
570 | for(int32_t i=0; i<zc_max(1,zc_min(254,guysbuf[id].misc1)); i++) |
| 20616 | { | ||
| 20617 | //christ this is messy -DD | ||
| 20618 | 485 | int32_t segclk = -i*((int32_t)(8.0/(zslongToFix(guysbuf[id&0xFFF].step*100)))); | |
| 20619 | |||
| 20620 |
4/8✓ Branch 0 taken 485 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 485 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 485 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 485 times.
✗ Branch 7 not taken.
|
485 | if(!guys.add(new esMoldorm((zfix)x,(zfix)y,id+0x1000,segclk))) |
| 20621 | { | ||
| 20622 | ✗ | al_trace("Moldorm segment %d could not be created!\n",i+1); | |
| 20623 | |||
| 20624 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20625 | ✗ | guys.del(guys.Count()-1); | |
| 20626 | |||
| 20627 | ✗ | return 0; | |
| 20628 | } | ||
| 20629 | |||
| 20630 |
2/2✓ Branch 0 taken 85 times.
✓ Branch 1 taken 400 times.
|
485 | if(i>0) |
| 20631 | 400 | ((enemy*)guys.spr(guys.Count()-1))->item_set=is; | |
| 20632 | |||
| 20633 | 485 | ret++; | |
| 20634 | 485 | } | |
| 20635 | |||
| 20636 | 85 | break; | |
| 20637 | } | ||
| 20638 | |||
| 20639 | case eeLANM: | ||
| 20640 | { | ||
| 20641 | 239 | id &= 0xFFF; | |
| 20642 | 239 | int32_t shft = guysbuf[id].misc2; | |
| 20643 | 239 | byte is=((enemy*)guys.spr(guys.Count()-1))->item_set; | |
| 20644 | |||
| 20645 |
4/8✓ Branch 0 taken 239 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 239 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 239 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 239 times.
✗ Branch 7 not taken.
|
239 | if(!guys.add(new esLanmola((zfix)x,(zfix)y,id+0x1000,0))) |
| 20646 | { | ||
| 20647 | ✗ | al_trace("Lanmola segment 1 could not be created!\n"); | |
| 20648 | ✗ | guys.del(guys.Count()-1); | |
| 20649 | ✗ | return 0; | |
| 20650 | } | ||
| 20651 | |||
| 20652 | 239 | ret++; | |
| 20653 | |||
| 20654 |
5/8✗ Branch 0 not taken.
✓ Branch 1 taken 1250 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1250 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1250 times.
✓ Branch 6 taken 1011 times.
✓ Branch 7 taken 239 times.
|
1250 | for(int32_t i=1; i<zc_max(1,zc_min(253,guysbuf[id&0xFFF].misc1)); i++) |
| 20655 | { | ||
| 20656 |
4/8✓ Branch 0 taken 1011 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1011 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1011 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1011 times.
✗ Branch 7 not taken.
|
1011 | if(!guys.add(new esLanmola((zfix)x,(zfix)y,id+0x2000,-(i<<shft)))) |
| 20657 | { | ||
| 20658 | ✗ | al_trace("Lanmola segment %d could not be created!\n",i+1); | |
| 20659 | |||
| 20660 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20661 | ✗ | guys.del(guys.Count()-1); | |
| 20662 | |||
| 20663 | ✗ | return 0; | |
| 20664 | } | ||
| 20665 | |||
| 20666 | 1011 | ((enemy*)guys.spr(guys.Count()-1))->item_set=is; | |
| 20667 | 1011 | ret++; | |
| 20668 | 1011 | } | |
| 20669 | } | ||
| 20670 | 239 | break; | |
| 20671 | |||
| 20672 | case eeMANHAN: | ||
| 20673 | 57 | id &= 0xFFF; | |
| 20674 | |||
| 20675 |
2/2✓ Branch 0 taken 260 times.
✓ Branch 1 taken 57 times.
|
317 | for(int32_t i=0; i<((!(guysbuf[id].misc2))?4:8); i++) |
| 20676 | { | ||
| 20677 |
4/8✓ Branch 0 taken 260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 260 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 260 times.
✗ Branch 7 not taken.
|
260 | if(!guys.add(new esManhandla((zfix)x,(zfix)y,id+0x1000,i))) |
| 20678 | { | ||
| 20679 | ✗ | al_trace("Manhandla head %d could not be created!\n",i+1); | |
| 20680 | |||
| 20681 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20682 | { | ||
| 20683 | ✗ | guys.del(guys.Count()-1); | |
| 20684 | ✗ | } | |
| 20685 | |||
| 20686 | ✗ | return 0; | |
| 20687 | } | ||
| 20688 | |||
| 20689 | 260 | ret++; | |
| 20690 | 260 | ((enemy*)guys.spr(guys.Count()-1))->frate=guysbuf[id].misc1; | |
| 20691 | 260 | } | |
| 20692 | |||
| 20693 | 57 | break; | |
| 20694 | |||
| 20695 | case eeGLEEOK: | ||
| 20696 | { | ||
| 20697 | 88 | id &= 0xFFF; | |
| 20698 | |||
| 20699 |
5/8✗ Branch 0 not taken.
✓ Branch 1 taken 347 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 347 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 347 times.
✓ Branch 6 taken 259 times.
✓ Branch 7 taken 88 times.
|
347 | for(int32_t i=0; i<zc_max(1,zc_min(254,guysbuf[id&0xFFF].misc1)); i++) |
| 20700 | { | ||
| 20701 |
4/8✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 259 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 259 times.
✗ Branch 7 not taken.
|
259 | if(!guys.add(new esGleeok((zfix)x,(zfix)y,id+0x1000,c, e))) |
| 20702 | { | ||
| 20703 | ✗ | al_trace("Gleeok head %d could not be created!\n",i+1); | |
| 20704 | |||
| 20705 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20706 | { | ||
| 20707 | ✗ | guys.del(guys.Count()-1); | |
| 20708 | ✗ | } | |
| 20709 | |||
| 20710 | ✗ | return false; | |
| 20711 | } | ||
| 20712 | |||
| 20713 | 259 | c-=guysbuf[id].misc4; | |
| 20714 | 259 | ret++; | |
| 20715 | 259 | } | |
| 20716 | } | ||
| 20717 | 88 | break; | |
| 20718 | |||
| 20719 | |||
| 20720 | case eePATRA: | ||
| 20721 | { | ||
| 20722 | 55 | id &= 0xFFF; | |
| 20723 | 55 | int32_t outeyes = 0; | |
| 20724 | |||
| 20725 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 489 times.
✓ Branch 2 taken 434 times.
✓ Branch 3 taken 55 times.
|
489 | for(int32_t i=0; i<zc_min(254,guysbuf[id&0xFFF].misc1); i++) |
| 20726 | { | ||
| 20727 |
10/22✓ Branch 0 taken 18 times.
✓ Branch 1 taken 416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 18 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 18 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 416 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 416 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 416 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 416 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
434 | if(!((guysbuf[id].misc10&&get_bit(quest_rules,qr_HARDCODED_BS_PATRA))?guys.add(new esPatraBS((zfix)x,(zfix)y,id+0x1000,i,e)):guys.add(new esPatra((zfix)x,(zfix)y,id+0x1000,i,e)))) |
| 20728 | { | ||
| 20729 | ✗ | al_trace("Patra outer eye %d could not be created!\n",i+1); | |
| 20730 | |||
| 20731 | ✗ | for(int32_t j=0; j<i+1; j++) | |
| 20732 | ✗ | guys.del(guys.Count()-1); | |
| 20733 | |||
| 20734 | ✗ | return 0; | |
| 20735 | } | ||
| 20736 | else | ||
| 20737 | 434 | outeyes++; | |
| 20738 | |||
| 20739 | 434 | ret++; | |
| 20740 | 434 | } | |
| 20741 | |||
| 20742 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
✓ Branch 2 taken 88 times.
✓ Branch 3 taken 55 times.
|
143 | for(int32_t i=0; i<zc_min(254,guysbuf[id&0xFFF].misc2); i++) |
| 20743 | { | ||
| 20744 |
4/8✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 88 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 88 times.
✗ Branch 7 not taken.
|
88 | if(!guys.add(new esPatra((zfix)x,(zfix)y,id+0x1000,i,e))) |
| 20745 | { | ||
| 20746 | ✗ | al_trace("Patra inner eye %d could not be created!\n",i+1); | |
| 20747 | |||
| 20748 | ✗ | for(int32_t j=0; j<i+1+zc_min(254,outeyes); j++) | |
| 20749 | ✗ | guys.del(guys.Count()-1); | |
| 20750 | |||
| 20751 | ✗ | return 0; | |
| 20752 | } | ||
| 20753 | |||
| 20754 | 88 | ret++; | |
| 20755 | 88 | } | |
| 20756 | |||
| 20757 | 55 | break; | |
| 20758 | } | ||
| 20759 | } | ||
| 20760 | |||
| 20761 | 43816 | return ret; | |
| 20762 | 43816 | } | |
| 20763 | |||
| 20764 | 809262 | bool isjumper(int32_t id) | |
| 20765 | { | ||
| 20766 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 809262 times.
|
809262 | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) |
| 20767 | { | ||
| 20768 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "isjumper()"); | ||
| 20769 | ✗ | return false; | |
| 20770 | } | ||
| 20771 |
3/3✓ Branch 0 taken 4 times.
✓ Branch 1 taken 733025 times.
✓ Branch 2 taken 76233 times.
|
809262 | switch(guysbuf[id&0xFFF].family) |
| 20772 | { | ||
| 20773 | case eeROCK: | ||
| 20774 | case eeTEK: | ||
| 20775 | 4 | return true; | |
| 20776 | |||
| 20777 | case eeWALK: | ||
| 20778 |
3/4✓ Branch 0 taken 76233 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12265 times.
✓ Branch 3 taken 63968 times.
|
76233 | if(guysbuf[id&0xFFF].misc9==e9tVIRE || guysbuf[id&0xFFF].misc9==e9tPOLSVOICE) return true; |
| 20779 | 63968 | } | |
| 20780 | |||
| 20781 | 796993 | return false; | |
| 20782 | 809262 | } | |
| 20783 | |||
| 20784 | |||
| 20785 | 102707 | bool isfixedtogrid(int32_t id) | |
| 20786 | { | ||
| 20787 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 102707 times.
|
102707 | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) |
| 20788 | { | ||
| 20789 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "isfixedtogrid()"); | ||
| 20790 | ✗ | return false; | |
| 20791 | } | ||
| 20792 |
1/2✓ Branch 0 taken 102707 times.
✗ Branch 1 not taken.
|
102707 | switch(guysbuf[id&0xFFF].family) |
| 20793 | { | ||
| 20794 | case eeWALK: | ||
| 20795 | case eeLEV: | ||
| 20796 | case eeZORA: | ||
| 20797 | case eeDONGO: | ||
| 20798 | case eeGANON: | ||
| 20799 | case eeROCK: | ||
| 20800 | case eeGLEEOK: | ||
| 20801 | case eeAQUA: | ||
| 20802 | case eeLANM: | ||
| 20803 | ✗ | return true; | |
| 20804 | } | ||
| 20805 | |||
| 20806 | 102707 | return false; | |
| 20807 | 102707 | } | |
| 20808 | |||
| 20809 | // Can't fall, can have Z value. | ||
| 20810 | 27497431 | bool isflier(int32_t id) | |
| 20811 | { | ||
| 20812 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27497431 times.
|
27497431 | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) |
| 20813 | { | ||
| 20814 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "isflier()"); | ||
| 20815 | ✗ | return false; | |
| 20816 | } | ||
| 20817 |
2/2✓ Branch 0 taken 24474679 times.
✓ Branch 1 taken 3022752 times.
|
27497431 | switch(guysbuf[id&0xFFF].family) //id&0x0FFF) |
| 20818 | { | ||
| 20819 | case eePEAHAT: | ||
| 20820 | case eeKEESE: | ||
| 20821 | case eePATRA: | ||
| 20822 | case eeFAIRY: | ||
| 20823 | case eeGHINI: | ||
| 20824 | |||
| 20825 | // Could theoretically have their Z set by a script | ||
| 20826 | case eeFIRE: | ||
| 20827 | 3022752 | return true; | |
| 20828 | break; | ||
| 20829 | } | ||
| 20830 | |||
| 20831 | 24474679 | return false; | |
| 20832 | 27497431 | } | |
| 20833 | |||
| 20834 | // Can't have Z position | ||
| 20835 | 1383374 | bool never_in_air(int32_t id) | |
| 20836 | { | ||
| 20837 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1383374 times.
|
1383374 | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) |
| 20838 | { | ||
| 20839 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "never_in_air()"); | ||
| 20840 | ✗ | return false; | |
| 20841 | } | ||
| 20842 |
2/2✓ Branch 0 taken 1373826 times.
✓ Branch 1 taken 9548 times.
|
1383374 | switch(guysbuf[id&0xFFF].family) |
| 20843 | { | ||
| 20844 | case eeMANHAN: | ||
| 20845 | case eeMOLD: | ||
| 20846 | case eeLANM: | ||
| 20847 | case eeGLEEOK: | ||
| 20848 | case eeZORA: | ||
| 20849 | case eeLEV: | ||
| 20850 | case eeAQUA: | ||
| 20851 | case eeROCK: | ||
| 20852 | case eeGANON: | ||
| 20853 | case eeTRAP: | ||
| 20854 | case eePROJECTILE: | ||
| 20855 | case eeSPINTILE: | ||
| 20856 | 9548 | return true; | |
| 20857 | } | ||
| 20858 | |||
| 20859 | 1373826 | return false; | |
| 20860 | 1383374 | } | |
| 20861 | |||
| 20862 | 903030 | bool canfall(int32_t id) | |
| 20863 | { | ||
| 20864 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 903030 times.
|
903030 | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) |
| 20865 | { | ||
| 20866 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "canfall()"); | ||
| 20867 | ✗ | return false; | |
| 20868 | } | ||
| 20869 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 903004 times.
✓ Branch 2 taken 26 times.
|
903030 | switch(guysbuf[id&0xFFF].family) |
| 20870 | { | ||
| 20871 | case eeGUY: | ||
| 20872 | { | ||
| 20873 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if(id < eOCTO1S) |
| 20874 | 26 | return false; | |
| 20875 | |||
| 20876 | ✗ | switch(guysbuf[id&0xFFF].misc10) | |
| 20877 | { | ||
| 20878 | case 1: | ||
| 20879 | case 2: | ||
| 20880 | ✗ | return true; | |
| 20881 | |||
| 20882 | case 0: | ||
| 20883 | ✗ | case 3: | |
| 20884 | default: | ||
| 20885 | ✗ | return false; | |
| 20886 | } | ||
| 20887 | |||
| 20888 | case eeGHOMA: | ||
| 20889 | case eeDIG: | ||
| 20890 | ✗ | return false; | |
| 20891 | } | ||
| 20892 | } | ||
| 20893 | |||
| 20894 | |||
| 20895 |
4/4✓ Branch 0 taken 894570 times.
✓ Branch 1 taken 8434 times.
✓ Branch 2 taken 85308 times.
✓ Branch 3 taken 809262 times.
|
903004 | return !never_in_air(id) && !isflier(id) && !isjumper(id); |
| 20896 | 903030 | } | |
| 20897 | |||
| 20898 | 27031693 | bool enemy::enemycanfall(int32_t id, bool checkgrav) | |
| 20899 | { | ||
| 20900 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27031693 times.
|
27031693 | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) |
| 20901 | { | ||
| 20902 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "enemycanfall()"); | ||
| 20903 | ✗ | return false; | |
| 20904 | } | ||
| 20905 | //Z_scripterrlog("canfall family is %d:\n", family); | ||
| 20906 | //Z_scripterrlog("canfall gravity is %s:\n", moveflags & FLAG_OBEYS_GRAV ? "true" : "false"); | ||
| 20907 | //if ( family == eeFIRE && id >= eSTART ) | ||
| 20908 | //{ | ||
| 20909 | // Z_scripterrlog("eeFire\n"); | ||
| 20910 | // return moveflags & FLAG_OBEYS_GRAV; //'Other' enemy class, used by scripts. -Z | ||
| 20911 | //} | ||
| 20912 | |||
| 20913 | //In ZQ, eeFIRE is Other(floating) and eeOTHER is 'other'. | ||
| 20914 | |||
| 20915 |
3/3✓ Branch 0 taken 194768 times.
✓ Branch 1 taken 26036161 times.
✓ Branch 2 taken 800764 times.
|
27031693 | switch(guysbuf[id&0xFFF].family) |
| 20916 | { | ||
| 20917 | case eeGUY: | ||
| 20918 | { | ||
| 20919 |
1/2✓ Branch 0 taken 800764 times.
✗ Branch 1 not taken.
|
800764 | if(id < eOCTO1S) //screen guys and fires that aren't real enemies, and never fall |
| 20920 | 800764 | return false; | |
| 20921 | |||
| 20922 | ✗ | switch(guysbuf[id&0xFFF].misc10) //I'm unsure what these specify off-hand. Needs better comments. -Z | |
| 20923 | { | ||
| 20924 | case 1: | ||
| 20925 | case 2: | ||
| 20926 | ✗ | return true; | |
| 20927 | |||
| 20928 | case 0: | ||
| 20929 | ✗ | case 3: | |
| 20930 | default: | ||
| 20931 | ✗ | return false; | |
| 20932 | } | ||
| 20933 | |||
| 20934 | case eeGHOMA: | ||
| 20935 | case eeDIG: | ||
| 20936 | 194768 | return false; | |
| 20937 | } | ||
| 20938 | } | ||
| 20939 | |||
| 20940 |
2/2✓ Branch 0 taken 19790429 times.
✓ Branch 1 taken 6245732 times.
|
26036161 | if(!checkgrav) return true; |
| 20941 | 19790429 | return (moveflags & FLAG_OBEYS_GRAV); | |
| 20942 | |||
| 20943 | // if ( isflier(id) || isjumper(id) || never_in_air(id) ) | ||
| 20944 | // { | ||
| 20945 | // if ( moveflags & FLAG_OBEYS_GRAV ) return true; | ||
| 20946 | // else return false; | ||
| 20947 | // } | ||
| 20948 | // else | ||
| 20949 | // { | ||
| 20950 | // return (moveflags & FLAG_OBEYS_GRAV); | ||
| 20951 | // } | ||
| 20952 | //return !never_in_air(id) && !isflier(id) && !isjumper(id); | ||
| 20953 | 27031693 | } | |
| 20954 | |||
| 20955 | 608 | void addfires() | |
| 20956 | { | ||
| 20957 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 272 times.
|
608 | if(!get_bit(quest_rules,qr_NOGUYFIRES)) |
| 20958 | { | ||
| 20959 | 336 | int32_t bs = get_bit(quest_rules,qr_BSZELDA); | |
| 20960 | 336 | addguy(bs? 64: 72,64,gFIRE,-17,false); | |
| 20961 | 336 | addguy(bs?176:168,64,gFIRE,-18,false); | |
| 20962 | 336 | } | |
| 20963 | 608 | } | |
| 20964 | |||
| 20965 | 13410 | void loadguys() | |
| 20966 | { | ||
| 20967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13410 times.
|
13410 | if(loaded_guys) |
| 20968 | ✗ | return; | |
| 20969 | |||
| 20970 | 13410 | loaded_guys=true; | |
| 20971 | |||
| 20972 | 13410 | byte Guy=0; | |
| 20973 | // When in caves/item rooms, use mSPECIALITEM and ipONETIME2 | ||
| 20974 | // Else use mITEM and ipONETIME | ||
| 20975 | 13410 | int32_t mf = (currscr>=128) ? mSPECIALITEM : mITEM; | |
| 20976 | 13410 | int32_t onetime = (currscr>=128) ? ipONETIME2 : ipONETIME; | |
| 20977 | |||
| 20978 | 13410 | repaircharge=0; | |
| 20979 | 13410 | adjustmagic=false; | |
| 20980 | 13410 | learnslash=false; | |
| 20981 | |||
| 20982 |
2/2✓ Branch 0 taken 40236 times.
✓ Branch 1 taken 13410 times.
|
53646 | for(int32_t i=0; i<3; i++) |
| 20983 | { | ||
| 20984 | 40236 | prices[i]=0; | |
| 20985 | 40236 | } | |
| 20986 | |||
| 20987 | 13410 | hasitem=0; | |
| 20988 | |||
| 20989 |
4/4✓ Branch 0 taken 679 times.
✓ Branch 1 taken 12731 times.
✓ Branch 2 taken 340 times.
✓ Branch 3 taken 339 times.
|
13410 | if(currscr>=128 && DMaps[currdmap].flags&dmfGUYCAVES) |
| 20990 | { | ||
| 20991 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 339 times.
|
339 | if(DMaps[currdmap].flags&dmfCAVES) |
| 20992 | { | ||
| 20993 | 339 | Guy=tmpscr[1].guy; | |
| 20994 | 339 | } | |
| 20995 | 339 | } | |
| 20996 | else | ||
| 20997 | { | ||
| 20998 | 13071 | Guy=tmpscr->guy; | |
| 20999 | |||
| 21000 |
4/4✓ Branch 0 taken 12733 times.
✓ Branch 1 taken 338 times.
✓ Branch 2 taken 7612 times.
✓ Branch 3 taken 5121 times.
|
13071 | if(currscr < 0x80 && (DMaps[currdmap].flags&dmfVIEWMAP)) |
| 21001 | 5121 | game->maps[(currmap*MAPSCRSNORMAL)+currscr] |= mVISITED; // mark as visited | |
| 21002 | } | ||
| 21003 | |||
| 21004 | // The Guy appears if 'Hero is in cave' equals 'Guy is in cave'. | ||
| 21005 |
4/4✓ Branch 0 taken 2707 times.
✓ Branch 1 taken 10703 times.
✓ Branch 2 taken 2083 times.
✓ Branch 3 taken 624 times.
|
13410 | if(Guy && ((currscr>=128) == !!(DMaps[currdmap].flags&dmfGUYCAVES))) |
| 21006 | { | ||
| 21007 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 616 times.
|
624 | if(tmpscr->room==rZELDA) |
| 21008 | { | ||
| 21009 | 8 | addguy(120,72,Guy,-15,true); | |
| 21010 | 8 | guys.spr(0)->hxofs=1000; | |
| 21011 | 8 | addenemy(128,96,eFIRE,-15); | |
| 21012 | 8 | addenemy(112,96,eFIRE,-15); | |
| 21013 | 8 | addenemy(96,120,eFIRE,-15); | |
| 21014 | 8 | addenemy(144,120,eFIRE,-15); | |
| 21015 | 8 | return; | |
| 21016 | } | ||
| 21017 | |||
| 21018 |
4/4✓ Branch 0 taken 10 times.
✓ Branch 1 taken 606 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 2 times.
|
616 | if(Guy!=gFAIRY || !get_bit(quest_rules,qr_NOFAIRYGUYFIRES)) |
| 21019 | 608 | addfires(); | |
| 21020 | |||
| 21021 |
2/2✓ Branch 0 taken 285 times.
✓ Branch 1 taken 335 times.
|
620 | if(currscr>=128) |
| 21022 |
3/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 323 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
|
347 | if(getmapflag() && !(tmpscr->flags9&fBELOWRETURN)) |
| 21023 | 12 | Guy=0; | |
| 21024 | |||
| 21025 |
4/6✓ Branch 0 taken 85 times.
✓ Branch 1 taken 511 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 23 times.
|
620 | switch(tmpscr->room) |
| 21026 | { | ||
| 21027 | case rSP_ITEM: | ||
| 21028 | case rGRUMBLE: | ||
| 21029 | case rBOMBS: | ||
| 21030 | case rARROWS: | ||
| 21031 | case rSWINDLE: | ||
| 21032 | case rMUPGRADE: | ||
| 21033 | case rLEARNSLASH: | ||
| 21034 | case rTAKEONE: | ||
| 21035 |
8/8✓ Branch 0 taken 32 times.
✓ Branch 1 taken 53 times.
✓ Branch 2 taken 27 times.
✓ Branch 3 taken 45 times.
✓ Branch 4 taken 53 times.
✓ Branch 5 taken 45 times.
✓ Branch 6 taken 20 times.
✓ Branch 7 taken 33 times.
|
85 | if((get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag((currscr < 128) ? mITEM : mSPECIALITEM)) || (!get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag() && !(tmpscr->flags9&fBELOWRETURN))) //get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) |
| 21036 | 27 | Guy=0; | |
| 21037 | |||
| 21038 | 125 | break; | |
| 21039 | |||
| 21040 | case rREPAIR: | ||
| 21041 | ✗ | if (get_bit(quest_rules, qr_OLD_DOORREPAIR)) break; | |
| 21042 | ✗ | if((get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag((currscr < 128) ? mITEM : mSPECIALITEM)) || (!get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag() && !(tmpscr->flags9&fBELOWRETURN))) //get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) | |
| 21043 | ✗ | Guy=0; | |
| 21044 | |||
| 21045 | ✗ | break; | |
| 21046 | case rRP_HC: | ||
| 21047 | ✗ | if (get_bit(quest_rules, qr_OLD_POTION_OR_HC)) break; | |
| 21048 | ✗ | if((get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag((currscr < 128) ? mITEM : mSPECIALITEM)) || (!get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag() && !(tmpscr->flags9&fBELOWRETURN))) //get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) | |
| 21049 | ✗ | Guy=0; | |
| 21050 | |||
| 21051 | ✗ | break; | |
| 21052 | case rMONEY: | ||
| 21053 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (get_bit(quest_rules, qr_OLD_SECRETMONEY)) break; |
| 21054 | ✗ | if((get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag((currscr < 128) ? mITEM : mSPECIALITEM)) || (!get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) && getmapflag() && !(tmpscr->flags9&fBELOWRETURN))) //get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW) | |
| 21055 | ✗ | Guy=0; | |
| 21056 | |||
| 21057 | ✗ | break; | |
| 21058 | |||
| 21059 | case rTRIFORCE: | ||
| 21060 | { | ||
| 21061 | 23 | int32_t tc = TriforceCount(); | |
| 21062 | |||
| 21063 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 11 times.
|
23 | if(get_bit(quest_rules,qr_4TRI)) |
| 21064 | { | ||
| 21065 |
4/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
|
11 | if((get_bit(quest_rules,qr_3TRI) && tc>=3) || tc>=4) |
| 21066 | 10 | Guy=0; | |
| 21067 | 9 | } | |
| 21068 | else | ||
| 21069 | { | ||
| 21070 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
|
12 | if((get_bit(quest_rules,qr_3TRI) && tc>=6) || tc>=8) |
| 21071 | 12 | Guy=0; | |
| 21072 | } | ||
| 21073 | } | ||
| 21074 | 21 | break; | |
| 21075 | } | ||
| 21076 | |||
| 21077 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 559 times.
|
618 | if(Guy) |
| 21078 | { | ||
| 21079 |
3/4✓ Branch 0 taken 10 times.
✓ Branch 1 taken 549 times.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
559 | if(Guy!=gFAIRY || !get_bit(quest_rules,qr_NOFAIRYGUYFIRES)) |
| 21080 | 549 | blockpath=true; | |
| 21081 | |||
| 21082 |
2/2✓ Branch 0 taken 323 times.
✓ Branch 1 taken 236 times.
|
559 | if(currscr<128) |
| 21083 | 236 | sfx(WAV_SCALE); | |
| 21084 | |||
| 21085 |
4/4✓ Branch 0 taken 326 times.
✓ Branch 1 taken 233 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 323 times.
|
559 | addguy(120,64,Guy, (dlevel||BSZ)?-15:startguy[zc_oldrand()&7], true); |
| 21086 | 559 | Hero.Freeze(); | |
| 21087 | 559 | } | |
| 21088 | 618 | } | |
| 21089 |
2/2✓ Branch 0 taken 12735 times.
✓ Branch 1 taken 51 times.
|
12786 | else if(Guy==gFAIRY) // The only Guy that somewhat ignores the "Guys In Caves Only" DMap flag |
| 21090 | { | ||
| 21091 | 51 | sfx(WAV_SCALE); | |
| 21092 | 51 | addguy(120,62,gFAIRY,-14,false); | |
| 21093 | 51 | } | |
| 21094 | |||
| 21095 | 13404 | loaditem(); | |
| 21096 | |||
| 21097 | // Collecting a rupee in a '10 Rupees' screen sets the mITEM screen state if | ||
| 21098 | // it doesn't appear in a Cave/Item Cellar, and the mSPECIALITEM screen state if it does. | ||
| 21099 |
4/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 13395 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 7 times.
|
13404 | if(tmpscr->room==r10RUPIES && !getmapflag(mf)) |
| 21100 | { | ||
| 21101 | //setmapflag(); | ||
| 21102 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 7 times.
|
77 | for(int32_t i=0; i<10; i++) |
| 21103 | 70 | additem(ten_rupies_x[i],ten_rupies_y[i],0,ipBIGRANGE+onetime,-14); | |
| 21104 | 7 | } | |
| 21105 | 13412 | } | |
| 21106 | |||
| 21107 | 13417 | void loaditem() | |
| 21108 | { | ||
| 21109 | 13417 | byte Item = 0; | |
| 21110 | |||
| 21111 |
2/2✓ Branch 0 taken 12738 times.
✓ Branch 1 taken 679 times.
|
13417 | if(currscr<128) |
| 21112 | { | ||
| 21113 | 12738 | Item=tmpscr->item; | |
| 21114 | |||
| 21115 |
4/4✓ Branch 0 taken 615 times.
✓ Branch 1 taken 12123 times.
✓ Branch 2 taken 11483 times.
✓ Branch 3 taken 1255 times.
|
12738 | if((!getmapflag(mITEM) || (tmpscr->flags9&fITEMRETURN)) && (tmpscr->hasitem != 0)) |
| 21116 | { | ||
| 21117 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
|
1255 | if(tmpscr->flags8&fSECRETITEM) |
| 21118 | ✗ | hasitem=8; | |
| 21119 |
2/2✓ Branch 0 taken 610 times.
✓ Branch 1 taken 645 times.
|
1255 | else if(tmpscr->flags&fITEM) |
| 21120 | 610 | hasitem=1; | |
| 21121 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 616 times.
|
645 | else if(tmpscr->enemyflags&efCARRYITEM) |
| 21122 | 29 | hasitem=4; // Will be set to 2 by roaming_item | |
| 21123 | else | ||
| 21124 |
2/4✓ Branch 0 taken 616 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 616 times.
✗ Branch 3 not taken.
|
1232 | items.add(new item((zfix)tmpscr->itemx, |
| 21125 |
7/14✓ Branch 0 taken 3 times.
✓ Branch 1 taken 613 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 616 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 616 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 616 times.
✗ Branch 13 not taken.
|
616 | (tmpscr->flags7&fITEMFALLS && isSideViewGravity()) ? (zfix)-170 : (zfix)tmpscr->itemy+(get_bit(quest_rules, qr_NOITEMOFFSET)?0:1), |
| 21126 |
6/10✓ Branch 0 taken 3 times.
✓ Branch 1 taken 613 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 613 times.
✗ Branch 9 not taken.
|
616 | (tmpscr->flags7&fITEMFALLS && !(isSideViewGravity())) ? (zfix)170 : (zfix)0, |
| 21127 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 556 times.
|
616 | Item,ipONETIME|ipBIGRANGE|((itemsbuf[Item].family==itype_triforcepiece || |
| 21128 | 616 | (tmpscr->flags3&fHOLDITEM)) ? ipHOLDUP : 0) | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0),0)); | |
| 21129 | 1255 | } | |
| 21130 | 12738 | } | |
| 21131 |
2/2✓ Branch 0 taken 339 times.
✓ Branch 1 taken 340 times.
|
679 | else if(!(DMaps[currdmap].flags&dmfCAVES)) |
| 21132 | { | ||
| 21133 |
4/6✓ Branch 0 taken 340 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 336 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
341 | if((!getmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (tmpscr[1].flags9&fBELOWRETURN)) && tmpscr[1].room==rSP_ITEM |
| 21134 |
4/4✓ Branch 0 taken 110 times.
✓ Branch 1 taken 230 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 109 times.
|
340 | && (currscr==128 || !get_bit(quest_rules,qr_ITEMSINPASSAGEWAYS))) |
| 21135 | { | ||
| 21136 | 110 | Item=tmpscr[1].catchall; | |
| 21137 | |||
| 21138 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 110 times.
|
110 | if(Item) |
| 21139 |
2/4✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110 times.
✗ Branch 3 not taken.
|
220 | items.add(new item((zfix)tmpscr->itemx, |
| 21140 |
4/14✗ Branch 0 not taken.
✓ Branch 1 taken 110 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 110 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 110 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 110 times.
✗ Branch 13 not taken.
|
110 | (tmpscr->flags7&fITEMFALLS && isSideViewGravity()) ? (zfix)-170 : (zfix)tmpscr->itemy+(get_bit(quest_rules, qr_NOITEMOFFSET)?0:1), |
| 21141 |
2/10✗ Branch 0 not taken.
✓ Branch 1 taken 110 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 110 times.
✗ Branch 9 not taken.
|
110 | (tmpscr->flags7&fITEMFALLS && !(isSideViewGravity())) ? (zfix)170 : (zfix)0, |
| 21142 | 110 | Item,ipONETIME2|ipBIGRANGE|ipHOLDUP | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0),0)); | |
| 21143 | 110 | } | |
| 21144 | 340 | } | |
| 21145 | 13417 | } | |
| 21146 | |||
| 21147 | 519 | void never_return(int32_t index) | |
| 21148 | { | ||
| 21149 |
2/2✓ Branch 0 taken 390 times.
✓ Branch 1 taken 129 times.
|
519 | if(!get_bit(quest_rules,qr_KILLALL)) |
| 21150 | 129 | goto doit; | |
| 21151 | |||
| 21152 |
2/2✓ Branch 0 taken 1313 times.
✓ Branch 1 taken 191 times.
|
1504 | for(int32_t i=0; i<guys.Count(); i++) |
| 21153 |
4/4✓ Branch 0 taken 490 times.
✓ Branch 1 taken 823 times.
✓ Branch 2 taken 199 times.
✓ Branch 3 taken 291 times.
|
1313 | if(((((enemy*)guys.spr(i))->d->flags)&guy_neverret) && i!=index) |
| 21154 | { | ||
| 21155 | 199 | goto dontdoit; | |
| 21156 | 191 | } | |
| 21157 | |||
| 21158 | doit: | ||
| 21159 | 320 | setmapflag(mNEVERRET); | |
| 21160 | dontdoit: | ||
| 21161 | 519 | return; | |
| 21162 | } | ||
| 21163 | |||
| 21164 | 31222 | bool slowguy(int32_t id) | |
| 21165 | { | ||
| 21166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31222 times.
|
31222 | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) |
| 21167 | { | ||
| 21168 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "slowguy()"); | ||
| 21169 | ✗ | return false; | |
| 21170 | } | ||
| 21171 | //return (guysbuf[id].step<100); | ||
| 21172 |
2/2✓ Branch 0 taken 26299 times.
✓ Branch 1 taken 4923 times.
|
31222 | switch(id) |
| 21173 | { | ||
| 21174 | case eOCTO1S: | ||
| 21175 | case eOCTO2S: | ||
| 21176 | case eOCTO1F: | ||
| 21177 | case eOCTO2F: | ||
| 21178 | case eLEV1: | ||
| 21179 | case eLEV2: | ||
| 21180 | case eROCK: | ||
| 21181 | case eBOULDER: | ||
| 21182 | 4923 | return true; | |
| 21183 | } | ||
| 21184 | |||
| 21185 | 26299 | return false; | |
| 21186 | 31222 | } | |
| 21187 | |||
| 21188 | 34865 | bool ok2add(int32_t id) | |
| 21189 | { | ||
| 21190 |
2/4✓ Branch 0 taken 34865 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 34865 times.
|
34865 | if( ((unsigned)(id&0xFFF)) > MAXGUYS || id <= 0) |
| 21191 | { | ||
| 21192 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "oktoadd()"); | ||
| 21193 | ✗ | return false; | |
| 21194 | } | ||
| 21195 |
4/4✓ Branch 0 taken 374 times.
✓ Branch 1 taken 34491 times.
✓ Branch 2 taken 170 times.
✓ Branch 3 taken 204 times.
|
34865 | if(getmapflag(mNEVERRET) && (guysbuf[id].flags & guy_neverret)) |
| 21196 | 204 | return false; | |
| 21197 | |||
| 21198 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 34537 times.
✓ Branch 2 taken 32 times.
✓ Branch 3 taken 92 times.
|
34661 | switch(guysbuf[id].family) |
| 21199 | { | ||
| 21200 | // I added a special case for shooters because having traps on the same screen | ||
| 21201 | // was preventing them from spawning due to TMPNORET. This means they will | ||
| 21202 | // never stay dead, though, so it may not be the best solution. - Saf | ||
| 21203 | case eePROJECTILE: | ||
| 21204 | 32 | return true; | |
| 21205 | |||
| 21206 | |||
| 21207 | case eeDIG: | ||
| 21208 | { | ||
| 21209 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
✓ Branch 2 taken 47 times.
|
92 | switch(guysbuf[id].misc10) |
| 21210 | { | ||
| 21211 | case 1: | ||
| 21212 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 32 times.
|
45 | if(!get_bit(quest_rules,qr_NOTMPNORET)) |
| 21213 | 13 | return !getmapflag(mTMPNORET); | |
| 21214 | |||
| 21215 | 32 | return true; | |
| 21216 | |||
| 21217 | 47 | case 0: | |
| 21218 | default: | ||
| 21219 | 47 | return true; | |
| 21220 | } | ||
| 21221 | } | ||
| 21222 | case eeGANON: | ||
| 21223 | case eeTRAP: | ||
| 21224 | ✗ | if ((guysbuf[id].family == eeGANON && !get_bit(quest_rules, qr_CAN_PLACE_GANON)) | |
| 21225 | ✗ | || (guysbuf[id].family == eeTRAP && !get_bit(quest_rules, qr_CAN_PLACE_TRAPS))) return false; | |
| 21226 | [[fallthrough]]; | ||
| 21227 | default: | ||
| 21228 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34537 times.
|
34537 | if (guysbuf[id].flags2&guy_ignoretmpnr) return true; |
| 21229 | 34537 | break; | |
| 21230 | } | ||
| 21231 | |||
| 21232 |
2/2✓ Branch 0 taken 12330 times.
✓ Branch 1 taken 22207 times.
|
34537 | if(!get_bit(quest_rules,qr_NOTMPNORET)) |
| 21233 | 22207 | return !getmapflag(mTMPNORET); | |
| 21234 | |||
| 21235 | 12330 | return true; | |
| 21236 | 34865 | } | |
| 21237 | |||
| 21238 | 263502 | void activate_fireball_statue(int32_t pos) | |
| 21239 | { | ||
| 21240 |
3/4✓ Branch 0 taken 100614 times.
✓ Branch 1 taken 162888 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 100614 times.
|
263502 | if(!(tmpscr->enemyflags&efFIREBALLS) || statueID<0) |
| 21241 | { | ||
| 21242 | 162888 | return; | |
| 21243 | } | ||
| 21244 | |||
| 21245 | 100614 | int32_t cx=-1000, cy=-1000; | |
| 21246 | 100614 | int32_t x = (pos&15)<<4; | |
| 21247 | 100614 | int32_t y = pos&0xF0; | |
| 21248 | |||
| 21249 | 100614 | int32_t ctype = combobuf[MAPCOMBO(x,y)].type; | |
| 21250 | |||
| 21251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100614 times.
|
100614 | if(!isfixedtogrid(statueID)) |
| 21252 | { | ||
| 21253 |
2/2✓ Branch 0 taken 996 times.
✓ Branch 1 taken 99618 times.
|
100614 | if(ctype==cL_STATUE) |
| 21254 | { | ||
| 21255 | 996 | cx=x+4; | |
| 21256 | 996 | cy=y+7; | |
| 21257 | 996 | } | |
| 21258 |
2/2✓ Branch 0 taken 1015 times.
✓ Branch 1 taken 98603 times.
|
99618 | else if(ctype==cR_STATUE) |
| 21259 | { | ||
| 21260 | 1015 | cx=x-8; | |
| 21261 | 1015 | cy=y-1; | |
| 21262 | 1015 | } | |
| 21263 |
2/2✓ Branch 0 taken 98521 times.
✓ Branch 1 taken 82 times.
|
98603 | else if(ctype==cC_STATUE) |
| 21264 | { | ||
| 21265 | 82 | cx=x; | |
| 21266 | 82 | cy=y; | |
| 21267 | 82 | } | |
| 21268 | 100614 | } | |
| 21269 | ✗ | else if(ctype==cL_STATUE || ctype==cR_STATUE || ctype==cC_STATUE) | |
| 21270 | { | ||
| 21271 | ✗ | cx=x; | |
| 21272 | ✗ | cy=y; | |
| 21273 | ✗ | } | |
| 21274 | |||
| 21275 |
2/2✓ Branch 0 taken 98521 times.
✓ Branch 1 taken 2093 times.
|
100614 | if(cx!=-1000) // No point creating it if this is false |
| 21276 | { | ||
| 21277 |
2/2✓ Branch 0 taken 6177 times.
✓ Branch 1 taken 2093 times.
|
8270 | for(int32_t j=0; j<guys.Count(); j++) |
| 21278 | { | ||
| 21279 |
3/4✓ Branch 0 taken 1164 times.
✓ Branch 1 taken 5013 times.
✓ Branch 2 taken 1164 times.
✗ Branch 3 not taken.
|
6177 | if((int32_t(guys.spr(j)->x)==cx)&&(int32_t(guys.spr(j)->y)==cy)) |
| 21280 | { | ||
| 21281 | ✗ | if((guys.spr(j)->id&0xFFF) == statueID) // There's already a matching enemy here! | |
| 21282 | ✗ | return; // No point deleting it. A script might be toying with it in some way. | |
| 21283 | else | ||
| 21284 | ✗ | guys.del(j); | |
| 21285 | ✗ | } | |
| 21286 | 6177 | } | |
| 21287 | |||
| 21288 | 2093 | addenemy(cx, cy, statueID, !isfixedtogrid(statueID) ? 24 : 0); | |
| 21289 | 2093 | } | |
| 21290 | 263502 | } | |
| 21291 | |||
| 21292 | 13328 | void activate_fireball_statues() | |
| 21293 | { | ||
| 21294 |
2/2✓ Branch 0 taken 557 times.
✓ Branch 1 taken 12771 times.
|
13328 | if(!(tmpscr->enemyflags&efFIREBALLS)) |
| 21295 | { | ||
| 21296 | 12771 | return; | |
| 21297 | } | ||
| 21298 | |||
| 21299 |
2/2✓ Branch 0 taken 557 times.
✓ Branch 1 taken 98032 times.
|
98589 | for(int32_t i=0; i<176; i++) |
| 21300 | { | ||
| 21301 | 98032 | activate_fireball_statue(i); | |
| 21302 | 98032 | } | |
| 21303 | 13328 | } | |
| 21304 | |||
| 21305 | 13328 | void load_default_enemies() | |
| 21306 | { | ||
| 21307 | 13328 | wallm_load_clk=frame-80; | |
| 21308 | 13328 | int32_t Id=0; | |
| 21309 | |||
| 21310 |
2/2✓ Branch 0 taken 12363 times.
✓ Branch 1 taken 965 times.
|
13328 | if(tmpscr->enemyflags&efZORA) |
| 21311 | { | ||
| 21312 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 965 times.
|
965 | if(zoraID>=0) |
| 21313 | 965 | addenemy(-16, -16, zoraID, 0); | |
| 21314 | 965 | } | |
| 21315 | |||
| 21316 |
2/2✓ Branch 0 taken 13225 times.
✓ Branch 1 taken 103 times.
|
13328 | if(tmpscr->enemyflags&efTRAP4) |
| 21317 | { | ||
| 21318 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 103 times.
|
103 | if(cornerTrapID>=0) |
| 21319 | { | ||
| 21320 | 103 | addenemy(32, 32, cornerTrapID, -14); | |
| 21321 | 103 | addenemy(208, 32, cornerTrapID, -14); | |
| 21322 | 103 | addenemy(32, 128, cornerTrapID, -14); | |
| 21323 | 103 | addenemy(208, 128, cornerTrapID, -14); | |
| 21324 | 103 | } | |
| 21325 | 103 | } | |
| 21326 | |||
| 21327 |
2/2✓ Branch 0 taken 146608 times.
✓ Branch 1 taken 13328 times.
|
159936 | for(int32_t y=0; y<176; y+=16) |
| 21328 | { | ||
| 21329 |
2/2✓ Branch 0 taken 2345728 times.
✓ Branch 1 taken 146608 times.
|
2492336 | for(int32_t x=0; x<256; x+=16) |
| 21330 | { | ||
| 21331 | 2345728 | int32_t ctype = combobuf[MAPCOMBO(x,y)].type; | |
| 21332 | 2345728 | int32_t cflag = MAPFLAG(x, y); | |
| 21333 | 2345728 | int32_t cflag_i = MAPCOMBOFLAG(x, y); | |
| 21334 | |||
| 21335 |
4/6✓ Branch 0 taken 2345728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2345670 times.
✓ Branch 3 taken 58 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2345670 times.
|
2345728 | if(ctype==cTRAP_H || cflag==mfTRAP_H || cflag_i==mfTRAP_H) |
| 21336 | { | ||
| 21337 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 48 times.
|
58 | if(trapLOSHorizontalID>=0) |
| 21338 | 48 | addenemy(x, y, trapLOSHorizontalID, -14); | |
| 21339 | 58 | } | |
| 21340 |
4/6✓ Branch 0 taken 2345670 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2345646 times.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2345646 times.
|
2345670 | else if(ctype==cTRAP_V || cflag==mfTRAP_V || cflag_i==mfTRAP_V) |
| 21341 | { | ||
| 21342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(trapLOSVerticalID>=0) |
| 21343 | 24 | addenemy(x, y, trapLOSVerticalID, -14); | |
| 21344 | 24 | } | |
| 21345 |
4/6✓ Branch 0 taken 2345646 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2345507 times.
✓ Branch 3 taken 139 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2345507 times.
|
2345646 | else if(ctype==cTRAP_4 || cflag==mfTRAP_4 || cflag_i==mfTRAP_4) |
| 21346 | { | ||
| 21347 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
|
139 | if(trapLOS4WayID>=0) |
| 21348 | { | ||
| 21349 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
|
139 | if(addenemy(x, y, trapLOS4WayID, -14)) |
| 21350 | 139 | guys.spr(guys.Count()-1)->dummy_int[1]=2; | |
| 21351 | 139 | } | |
| 21352 | 139 | } | |
| 21353 | |||
| 21354 |
4/6✓ Branch 0 taken 2345507 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2345447 times.
✓ Branch 3 taken 60 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2345447 times.
|
2345507 | else if(ctype==cTRAP_LR || cflag==mfTRAP_LR || cflag_i==mfTRAP_LR) |
| 21355 | { | ||
| 21356 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | if(trapConstantHorizontalID>=0) |
| 21357 | 60 | addenemy(x, y, trapConstantHorizontalID, -14); | |
| 21358 | 60 | } | |
| 21359 |
4/6✓ Branch 0 taken 2345447 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2345367 times.
✓ Branch 3 taken 80 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2345367 times.
|
2345447 | else if(ctype==cTRAP_UD || cflag==mfTRAP_UD || cflag_i==mfTRAP_UD) |
| 21360 | { | ||
| 21361 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
|
80 | if(trapConstantVerticalID>=0) |
| 21362 | 80 | addenemy(x, y, trapConstantVerticalID, -14); | |
| 21363 | 80 | } | |
| 21364 | |||
| 21365 |
1/2✓ Branch 0 taken 2345728 times.
✗ Branch 1 not taken.
|
2345728 | if(ctype==cSPINTILE1) |
| 21366 | { | ||
| 21367 | // Awaken spinning tile | ||
| 21368 | ✗ | awaken_spinning_tile(tmpscr,COMBOPOS(x,y)); | |
| 21369 | ✗ | } | |
| 21370 | 2345728 | } | |
| 21371 | 146608 | } | |
| 21372 | |||
| 21373 |
2/2✓ Branch 0 taken 13286 times.
✓ Branch 1 taken 42 times.
|
13328 | if(tmpscr->enemyflags&efTRAP2) |
| 21374 | { | ||
| 21375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
|
42 | if(centerTrapID>=-1) |
| 21376 | { | ||
| 21377 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
|
42 | if(addenemy(64, 80, centerTrapID, -14)) |
| 21378 | 42 | guys.spr(guys.Count()-1)->dummy_int[1]=1; | |
| 21379 | |||
| 21380 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
|
42 | if(addenemy(176, 80, centerTrapID, -14)) |
| 21381 | 42 | guys.spr(guys.Count()-1)->dummy_int[1]=1; | |
| 21382 | 42 | } | |
| 21383 | 42 | } | |
| 21384 | |||
| 21385 |
2/2✓ Branch 0 taken 13267 times.
✓ Branch 1 taken 61 times.
|
13328 | if(tmpscr->enemyflags&efROCKS) |
| 21386 | { | ||
| 21387 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(rockID>=0) |
| 21388 | { | ||
| 21389 | 61 | addenemy(zc_oldrand()&0xF0, 0, rockID, 0); | |
| 21390 | 61 | addenemy(zc_oldrand()&0xF0, 0, rockID, 0); | |
| 21391 | 61 | addenemy(zc_oldrand()&0xF0, 0, rockID, 0); | |
| 21392 | 61 | } | |
| 21393 | 61 | } | |
| 21394 | |||
| 21395 | 13328 | activate_fireball_statues(); | |
| 21396 | 13328 | } | |
| 21397 | |||
| 21398 | 16642458 | void update_slope_combopos(int32_t lyr, int32_t pos) | |
| 21399 | { | ||
| 21400 |
2/4✓ Branch 0 taken 16642458 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16642458 times.
|
16642458 | if(unsigned(lyr) > 6 || unsigned(pos) > 175) return; |
| 21401 | 16642458 | mapscr* s = FFCore.tempScreens[lyr]; | |
| 21402 | 16642458 | newcombo const& cmb = combobuf[s->data[pos]]; | |
| 21403 | |||
| 21404 | 16642458 | auto id = (176*lyr)+pos; | |
| 21405 | 16642458 | auto it = slopes.find(id); | |
| 21406 | |||
| 21407 | 16642458 | bool wasSlope = it!=slopes.end(); | |
| 21408 | 16642458 | bool isSlope = cmb.type == cSLOPE; | |
| 21409 | |||
| 21410 |
3/4✓ Branch 0 taken 183 times.
✓ Branch 1 taken 16642275 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 183 times.
|
16642458 | if(isSlope && !wasSlope) |
| 21411 | { | ||
| 21412 | 183 | slopes.try_emplace(id, &(s->data[pos]), nullptr, id, pos); | |
| 21413 | 183 | } | |
| 21414 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 16642275 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
16642275 | else if(wasSlope && !isSlope) |
| 21415 | { | ||
| 21416 | ✗ | slopes.erase(it); | |
| 21417 | ✗ | } | |
| 21418 | 16642458 | } | |
| 21419 | 13425 | void update_slope_comboposes() | |
| 21420 | { | ||
| 21421 |
2/2✓ Branch 0 taken 93975 times.
✓ Branch 1 taken 13425 times.
|
107400 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 21422 | { | ||
| 21423 |
2/2✓ Branch 0 taken 16539600 times.
✓ Branch 1 taken 93975 times.
|
16633575 | for(auto pos = 0; pos < 176; ++pos) |
| 21424 | 16539600 | update_slope_combopos(lyr,pos); | |
| 21425 | 93975 | } | |
| 21426 | 13425 | } | |
| 21427 | |||
| 21428 | // Everything that must be done before we change a screen's combo to another combo, or a combo's type to another type. | ||
| 21429 | // There's 2 routines because it's unclear if combobuf or tmpscr->data gets modified. -L | ||
| 21430 | 165470 | void screen_combo_modify_preroutine(mapscr *s, int32_t pos) | |
| 21431 | { | ||
| 21432 | 165470 | delete_fireball_shooter(s, pos); | |
| 21433 | 165470 | } | |
| 21434 | |||
| 21435 | //Placeholder in case we need it. | ||
| 21436 | ✗ | void screen_ffc_modify_preroutine(word index) | |
| 21437 | { | ||
| 21438 | ✗ | return; | |
| 21439 | } | ||
| 21440 | |||
| 21441 | // Everything that must be done after we change a screen's combo to another combo. -L | ||
| 21442 | 165470 | void screen_combo_modify_postroutine(mapscr *s, int32_t pos) | |
| 21443 | { | ||
| 21444 | 165470 | s->valid |= mVALID; | |
| 21445 | 165470 | activate_fireball_statue(pos); | |
| 21446 | |||
| 21447 |
2/2✓ Branch 0 taken 165376 times.
✓ Branch 1 taken 94 times.
|
165470 | if(combobuf[s->data[pos]].type==cSPINTILE1) |
| 21448 | { | ||
| 21449 | // Awaken spinning tile | ||
| 21450 | 94 | awaken_spinning_tile(s,pos); | |
| 21451 | 94 | } | |
| 21452 | 165470 | int32_t lyr = -1; | |
| 21453 |
2/2✓ Branch 0 taken 88199 times.
✓ Branch 1 taken 77271 times.
|
165470 | if(s == tmpscr) lyr = 0; |
| 21454 |
2/2✓ Branch 0 taken 62612 times.
✓ Branch 1 taken 469914 times.
|
532526 | else for(size_t q = 0; q < 6; ++q) |
| 21455 | { | ||
| 21456 |
2/2✓ Branch 0 taken 25587 times.
✓ Branch 1 taken 444327 times.
|
469914 | if(s == tmpscr2+q) |
| 21457 | { | ||
| 21458 | 25587 | lyr = q+1; | |
| 21459 | 25587 | break; | |
| 21460 | } | ||
| 21461 | 444327 | } | |
| 21462 |
2/2✓ Branch 0 taken 62612 times.
✓ Branch 1 taken 102858 times.
|
165470 | if(lyr > -1) |
| 21463 | 102858 | update_slope_combopos(lyr,pos); | |
| 21464 | 165470 | } | |
| 21465 | |||
| 21466 | 2822407 | void screen_ffc_modify_postroutine(word index) | |
| 21467 | { | ||
| 21468 | 2822407 | ffcdata& ff = tmpscr->ffcs[index]; | |
| 21469 | 2822407 | newcombo const& cmb = combobuf[ff.getData()]; | |
| 21470 | |||
| 21471 | 2822407 | auto id = (176*7)+int32_t(index); | |
| 21472 | 2822407 | auto it = slopes.find(id); | |
| 21473 | |||
| 21474 | 2822407 | bool wasSlope = it!=slopes.end(); | |
| 21475 |
2/2✓ Branch 0 taken 2822052 times.
✓ Branch 1 taken 355 times.
|
2822407 | bool isSlope = cmb.type == cSLOPE && !(ff.flags&ffCHANGER); |
| 21476 |
3/4✓ Branch 0 taken 341 times.
✓ Branch 1 taken 2822066 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 341 times.
|
2822407 | if(isSlope && !wasSlope) |
| 21477 | { | ||
| 21478 | 341 | slopes.try_emplace(id, nullptr, &ff, id); | |
| 21479 | 341 | } | |
| 21480 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2822065 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2822066 | else if(wasSlope && !isSlope) |
| 21481 | { | ||
| 21482 | 1 | slopes.erase(it); | |
| 21483 | 1 | } | |
| 21484 | |||
| 21485 | 2822407 | tmpscr->ffcCountMarkDirty(); | |
| 21486 | 2822407 | } | |
| 21487 | |||
| 21488 | 1080 | void screen_combo_modify_pre(int32_t cid) | |
| 21489 | { | ||
| 21490 |
2/2✓ Branch 0 taken 7560 times.
✓ Branch 1 taken 1080 times.
|
8640 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 21491 | { | ||
| 21492 | 7560 | mapscr* t = FFCore.tempScreens[lyr]; | |
| 21493 |
2/2✓ Branch 0 taken 1330560 times.
✓ Branch 1 taken 7560 times.
|
1338120 | for(int32_t i = 0; i < 176; i++) |
| 21494 | { | ||
| 21495 |
2/2✓ Branch 0 taken 1329640 times.
✓ Branch 1 taken 920 times.
|
1330560 | if(t->data[i] == cid) |
| 21496 | { | ||
| 21497 | 920 | screen_combo_modify_preroutine(t,i); | |
| 21498 | 920 | } | |
| 21499 | 1330560 | } | |
| 21500 | 7560 | } | |
| 21501 | 1080 | } | |
| 21502 | 1080 | void screen_combo_modify_post(int32_t cid) | |
| 21503 | { | ||
| 21504 |
2/2✓ Branch 0 taken 7560 times.
✓ Branch 1 taken 1080 times.
|
8640 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 21505 | { | ||
| 21506 | 7560 | mapscr* t = FFCore.tempScreens[lyr]; | |
| 21507 |
2/2✓ Branch 0 taken 1330560 times.
✓ Branch 1 taken 7560 times.
|
1338120 | for(int32_t i = 0; i < 176; i++) |
| 21508 | { | ||
| 21509 |
2/2✓ Branch 0 taken 1329640 times.
✓ Branch 1 taken 920 times.
|
1330560 | if(t->data[i] == cid) |
| 21510 | { | ||
| 21511 | 920 | screen_combo_modify_postroutine(t,i); | |
| 21512 | 920 | } | |
| 21513 | 1330560 | } | |
| 21514 | 7560 | } | |
| 21515 |
2/2✓ Branch 0 taken 138240 times.
✓ Branch 1 taken 1080 times.
|
139320 | for(word ind = 0; ind < MAXFFCS; ++ind) |
| 21516 | { | ||
| 21517 |
1/2✓ Branch 0 taken 138240 times.
✗ Branch 1 not taken.
|
138240 | if(tmpscr->ffcs[ind].getData() == cid) |
| 21518 | ✗ | screen_ffc_modify_postroutine(ind); | |
| 21519 | 138240 | } | |
| 21520 | 1080 | } | |
| 21521 | |||
| 21522 | 94 | void awaken_spinning_tile(mapscr *s, int32_t pos) | |
| 21523 | { | ||
| 21524 |
1/2✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
|
94 | addenemy((pos&15)<<4,pos&0xF0,(s->cset[pos]<<12)+eSPINTILE1,combobuf[s->data[pos]].o_tile+zc_max(1,combobuf[s->data[pos]].frames)); |
| 21525 | 94 | } | |
| 21526 | |||
| 21527 | |||
| 21528 | // It stands for next_side_pos | ||
| 21529 | 9987 | void nsp(bool random) | |
| 21530 | // moves sle_x and sle_y to the next position | ||
| 21531 | { | ||
| 21532 |
2/2✓ Branch 0 taken 3261 times.
✓ Branch 1 taken 6726 times.
|
9987 | if(random) |
| 21533 | { | ||
| 21534 |
2/2✓ Branch 0 taken 1634 times.
✓ Branch 1 taken 1627 times.
|
3261 | if(zc_oldrand()%2) |
| 21535 | { | ||
| 21536 | 1634 | sle_x = (zc_oldrand()%2) ? 0 : 240; | |
| 21537 | 1634 | sle_y = (zc_oldrand()%10)*16; | |
| 21538 | 1634 | } | |
| 21539 | else | ||
| 21540 | { | ||
| 21541 | 1627 | sle_y = (zc_oldrand()%2) ? 0 : 160; | |
| 21542 | 1627 | sle_x = (zc_oldrand()%15)*16; | |
| 21543 | } | ||
| 21544 | |||
| 21545 | 3261 | return; | |
| 21546 | } | ||
| 21547 | |||
| 21548 |
2/2✓ Branch 0 taken 5084 times.
✓ Branch 1 taken 1642 times.
|
6726 | if(sle_x==0) |
| 21549 | { | ||
| 21550 |
2/2✓ Branch 0 taken 1496 times.
✓ Branch 1 taken 146 times.
|
1642 | if(sle_y<160) |
| 21551 | 1496 | sle_y+=16; | |
| 21552 | else | ||
| 21553 | 146 | sle_x+=16; | |
| 21554 | 1642 | } | |
| 21555 |
2/2✓ Branch 0 taken 2122 times.
✓ Branch 1 taken 2962 times.
|
5084 | else if(sle_y==160) |
| 21556 | { | ||
| 21557 |
2/2✓ Branch 0 taken 1985 times.
✓ Branch 1 taken 137 times.
|
2122 | if(sle_x<240) |
| 21558 | 1985 | sle_x+=16; | |
| 21559 | else | ||
| 21560 | 137 | sle_y-=16; | |
| 21561 | 2122 | } | |
| 21562 |
2/2✓ Branch 0 taken 1288 times.
✓ Branch 1 taken 1674 times.
|
2962 | else if(sle_x==240) |
| 21563 | { | ||
| 21564 |
2/2✓ Branch 0 taken 1165 times.
✓ Branch 1 taken 123 times.
|
1288 | if(sle_y>0) |
| 21565 | 1165 | sle_y-=16; | |
| 21566 | else | ||
| 21567 | 123 | sle_x-=16; | |
| 21568 | 1288 | } | |
| 21569 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1674 times.
|
1674 | else if(sle_y==0) |
| 21570 | { | ||
| 21571 |
1/2✓ Branch 0 taken 1674 times.
✗ Branch 1 not taken.
|
1674 | if(sle_x>0) |
| 21572 | 1674 | sle_x-=16; | |
| 21573 | else | ||
| 21574 | ✗ | sle_y+=16; | |
| 21575 | 1674 | } | |
| 21576 | 9987 | } | |
| 21577 | |||
| 21578 | 1932 | int32_t next_side_pos(bool random) | |
| 21579 | // moves sle_x and sle_y to the next available position | ||
| 21580 | // returns the direction the enemy should face | ||
| 21581 | { | ||
| 21582 | bool blocked; | ||
| 21583 | 1932 | int32_t c=0; | |
| 21584 | |||
| 21585 | 1932 | do | |
| 21586 | { | ||
| 21587 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 9862 times.
|
9987 | nsp(c>35 ? false : random); |
| 21588 |
3/4✓ Branch 0 taken 1931 times.
✓ Branch 1 taken 8056 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1931 times.
|
11918 | blocked = _walkflag(sle_x,sle_y,2) || _walkflag(sle_x,sle_y+8,2) || |
| 21589 |
1/2✓ Branch 0 taken 1931 times.
✗ Branch 1 not taken.
|
1931 | (combo_class_buf[COMBOTYPE(sle_x,sle_y)].block_enemies || |
| 21590 |
2/4✓ Branch 0 taken 1931 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1931 times.
✗ Branch 3 not taken.
|
1931 | MAPFLAG(sle_x,sle_y) == mfNOENEMY || MAPCOMBOFLAG(sle_x,sle_y)==mfNOENEMY || |
| 21591 |
2/4✓ Branch 0 taken 1931 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1931 times.
|
1931 | MAPFLAG(sle_x,sle_y) == mfNOGROUNDENEMY || MAPCOMBOFLAG(sle_x,sle_y)==mfNOGROUNDENEMY || |
| 21592 | 1931 | iswaterex(MAPCOMBO(sle_x,sle_y), currmap, currscr, -1, sle_x, sle_y, true)); | |
| 21593 | |||
| 21594 |
2/2✓ Branch 0 taken 9986 times.
✓ Branch 1 taken 1 times.
|
9987 | if(++c>50) |
| 21595 | 1 | return -1; | |
| 21596 |
2/2✓ Branch 0 taken 8055 times.
✓ Branch 1 taken 1931 times.
|
9986 | } |
| 21597 | 9986 | while(blocked); | |
| 21598 | |||
| 21599 | 1931 | int32_t dir=0; | |
| 21600 | |||
| 21601 |
2/2✓ Branch 0 taken 1354 times.
✓ Branch 1 taken 577 times.
|
1931 | if(sle_x==0) dir=right; |
| 21602 | |||
| 21603 |
2/2✓ Branch 0 taken 1430 times.
✓ Branch 1 taken 501 times.
|
1931 | if(sle_y==0) dir=down; |
| 21604 | |||
| 21605 |
2/2✓ Branch 0 taken 1389 times.
✓ Branch 1 taken 542 times.
|
1931 | if(sle_x==240) dir=left; |
| 21606 | |||
| 21607 |
1/2✓ Branch 0 taken 1931 times.
✗ Branch 1 not taken.
|
1931 | if(sle_y==168) dir=up; |
| 21608 | |||
| 21609 | 1931 | return dir; | |
| 21610 | 1932 | } | |
| 21611 | |||
| 21612 | ✗ | bool can_side_load(int32_t id) | |
| 21613 | { | ||
| 21614 | ✗ | if( ((unsigned)(id&0xFFF)) > MAXGUYS ) | |
| 21615 | { | ||
| 21616 | //zprint2("Invalid enemy ID (%d) passed to %s\n", id, "can_side_load()"); | ||
| 21617 | ✗ | return false; | |
| 21618 | } | ||
| 21619 | ✗ | switch(guysbuf[id].family) //id&0x0FFF) | |
| 21620 | { | ||
| 21621 | //case eTEK1: | ||
| 21622 | //case eTEK2: | ||
| 21623 | //case eTEK3: | ||
| 21624 | //case eLEV1: | ||
| 21625 | //case eLEV2: | ||
| 21626 | //case eLEV3: | ||
| 21627 | //case eRAQUAM: | ||
| 21628 | //case eLAQUAM: | ||
| 21629 | //case eDODONGO: | ||
| 21630 | //case eMANHAN: | ||
| 21631 | //case eGLEEOK1: | ||
| 21632 | //case eGLEEOK2: | ||
| 21633 | //case eGLEEOK3: | ||
| 21634 | //case eGLEEOK4: | ||
| 21635 | //case eDIG1: | ||
| 21636 | //case eDIG3: | ||
| 21637 | //case eGOHMA1: | ||
| 21638 | //case eGOHMA2: | ||
| 21639 | //case eCENT1: | ||
| 21640 | //case eCENT2: | ||
| 21641 | //case ePATRA1: | ||
| 21642 | //case ePATRA2: | ||
| 21643 | //case eGANON: | ||
| 21644 | //case eMANHAN2: | ||
| 21645 | //case eCEILINGM: later | ||
| 21646 | //case eFLOORM: later | ||
| 21647 | //case ePATRABS: | ||
| 21648 | //case ePATRAL2: | ||
| 21649 | //case ePATRAL3: | ||
| 21650 | //case eGLEEOK1F: | ||
| 21651 | //case eGLEEOK2F: | ||
| 21652 | //case eGLEEOK3F: | ||
| 21653 | //case eGLEEOK4F: | ||
| 21654 | //case eDODONGOBS: | ||
| 21655 | //case eDODONGOF: | ||
| 21656 | //case eGOHMA3: | ||
| 21657 | //case eGOHMA4: | ||
| 21658 | //case eSHOOTMAGIC: | ||
| 21659 | //case eSHOOTROCK: | ||
| 21660 | //case eSHOOTSPEAR: | ||
| 21661 | //case eSHOOTSWORD: | ||
| 21662 | //case eSHOOTFLAME: | ||
| 21663 | //case eSHOOTFLAME2: | ||
| 21664 | //case eSHOOTFBALL: | ||
| 21665 | case eeTEK: | ||
| 21666 | case eeLEV: | ||
| 21667 | case eeAQUA: | ||
| 21668 | case eeDONGO: | ||
| 21669 | case eeMANHAN: | ||
| 21670 | case eeGLEEOK: | ||
| 21671 | case eeDIG: | ||
| 21672 | case eeGHOMA: | ||
| 21673 | case eeLANM: | ||
| 21674 | case eePATRA: | ||
| 21675 | case eeGANON: | ||
| 21676 | case eePROJECTILE: | ||
| 21677 | ✗ | return false; | |
| 21678 | break; | ||
| 21679 | } | ||
| 21680 | |||
| 21681 | ✗ | return true; | |
| 21682 | ✗ | } | |
| 21683 | |||
| 21684 | static bool script_sle = false; | ||
| 21685 | static int32_t sle_pattern = 0; | ||
| 21686 | ✗ | void script_side_load_enemies() | |
| 21687 | { | ||
| 21688 | ✗ | if(script_sle || sle_clk) return; | |
| 21689 | ✗ | sle_cnt = 0; | |
| 21690 | ✗ | while(sle_cnt<10 && tmpscr->enemy[sle_cnt]!=0) | |
| 21691 | ✗ | ++sle_cnt; | |
| 21692 | ✗ | script_sle = true; | |
| 21693 | ✗ | sle_pattern = tmpscr->pattern; | |
| 21694 | ✗ | sle_clk = 0; | |
| 21695 | ✗ | } | |
| 21696 | |||
| 21697 | 42952 | void side_load_enemies() | |
| 21698 | { | ||
| 21699 |
3/4✓ Branch 0 taken 42952 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42374 times.
✓ Branch 3 taken 578 times.
|
42952 | if(!script_sle && sle_clk==0) |
| 21700 | { | ||
| 21701 | 578 | sle_pattern = tmpscr->pattern; | |
| 21702 | 578 | sle_cnt = 0; | |
| 21703 | 578 | int32_t guycnt = 0; | |
| 21704 | 578 | int16_t s = (currmap<<7)+currscr; | |
| 21705 | 578 | bool beenhere=false; | |
| 21706 | 578 | bool reload=true; | |
| 21707 | 578 | bool unbeatablereload = true; | |
| 21708 | |||
| 21709 | 578 | load_default_enemies(); | |
| 21710 | |||
| 21711 |
2/2✓ Branch 0 taken 3468 times.
✓ Branch 1 taken 578 times.
|
4046 | for(int32_t i=0; i<6; i++) |
| 21712 |
2/2✓ Branch 0 taken 3290 times.
✓ Branch 1 taken 178 times.
|
3646 | if(visited[i]==s) |
| 21713 | 178 | beenhere=true; | |
| 21714 | |||
| 21715 |
2/2✓ Branch 0 taken 178 times.
✓ Branch 1 taken 400 times.
|
578 | if(!beenhere) |
| 21716 | { | ||
| 21717 | 400 | visited[vhead]=s; | |
| 21718 | 400 | vhead = (vhead+1)%6; | |
| 21719 | 400 | } | |
| 21720 |
2/2✓ Branch 0 taken 139 times.
✓ Branch 1 taken 39 times.
|
178 | else if(game->guys[s]==0) |
| 21721 | { | ||
| 21722 | 39 | sle_cnt=0; | |
| 21723 | 39 | reload=false; | |
| 21724 | 39 | } | |
| 21725 | |||
| 21726 |
2/2✓ Branch 0 taken 387 times.
✓ Branch 1 taken 191 times.
|
578 | if(reload) |
| 21727 | { | ||
| 21728 | 191 | sle_cnt = game->guys[s]; | |
| 21729 | |||
| 21730 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 191 times.
|
191 | if((get_bit(quest_rules, qr_NO_LEAVE_ONE_ENEMY_ALIVE_TRICK) && !beenhere) |
| 21731 |
2/2✓ Branch 0 taken 177 times.
✓ Branch 1 taken 177 times.
|
191 | || sle_cnt==0) |
| 21732 | { | ||
| 21733 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 981 times.
✓ Branch 2 taken 806 times.
✓ Branch 3 taken 177 times.
|
983 | while(sle_cnt<10 && tmpscr->enemy[sle_cnt]!=0) |
| 21734 | 806 | ++sle_cnt; | |
| 21735 | 177 | } | |
| 21736 |
3/4✓ Branch 0 taken 400 times.
✓ Branch 1 taken 139 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 400 times.
|
539 | if (!beenhere && get_bit(quest_rules, qr_UNBEATABLES_DONT_KEEP_DEAD)) |
| 21737 | { | ||
| 21738 | ✗ | for(int32_t i = 0; i<sle_cnt && tmpscr->enemy[i]>0; i++) | |
| 21739 | { | ||
| 21740 | ✗ | if (!(guysbuf[tmpscr->enemy[i]].flags & guy_doesntcount)) | |
| 21741 | { | ||
| 21742 | ✗ | unbeatablereload = false; | |
| 21743 | ✗ | } | |
| 21744 | ✗ | } | |
| 21745 | ✗ | if (unbeatablereload) | |
| 21746 | { | ||
| 21747 | ✗ | while(sle_cnt<10 && tmpscr->enemy[sle_cnt]!=0) | |
| 21748 | { | ||
| 21749 | ✗ | ++sle_cnt; | |
| 21750 | } | ||
| 21751 | ✗ | } | |
| 21752 | ✗ | } | |
| 21753 | 539 | } | |
| 21754 | |||
| 21755 |
4/4✓ Branch 0 taken 578 times.
✓ Branch 1 taken 348 times.
✓ Branch 2 taken 348 times.
✓ Branch 3 taken 230 times.
|
926 | if((get_bit(quest_rules,qr_ALWAYSRET)) || (tmpscr->flags3&fENEMIESRETURN)) |
| 21756 | { | ||
| 21757 | 696 | sle_cnt = 0; | |
| 21758 | |||
| 21759 |
0/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
696 | while(sle_cnt<10 && tmpscr->enemy[sle_cnt]!=0) |
| 21760 | ✗ | ++sle_cnt; | |
| 21761 | ✗ | } | |
| 21762 | |||
| 21763 |
2/2✓ Branch 0 taken 1889 times.
✓ Branch 1 taken 230 times.
|
2119 | for(int32_t i=0; i<sle_cnt; i++) |
| 21764 | 1889 | ++guycnt; | |
| 21765 | |||
| 21766 | 230 | game->guys[s] = guycnt; | |
| 21767 | 230 | } | |
| 21768 | |||
| 21769 |
2/2✓ Branch 0 taken 40672 times.
✓ Branch 1 taken 1932 times.
|
42604 | if((++sle_clk+8)%24 == 0) |
| 21770 | { | ||
| 21771 | 1932 | int32_t dir = next_side_pos(sle_pattern==pSIDESR); | |
| 21772 | |||
| 21773 |
4/4✓ Branch 0 taken 1931 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 192 times.
✓ Branch 3 taken 1739 times.
|
1932 | if(dir==-1 || tooclose(sle_x,sle_y,32)) |
| 21774 | { | ||
| 21775 | 193 | return; | |
| 21776 | } | ||
| 21777 | |||
| 21778 | 1739 | int32_t enemy_slot=guys.Count(); | |
| 21779 | |||
| 21780 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1739 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1739 times.
|
1739 | while(sle_cnt > 0 && !ok2add(tmpscr->enemy[sle_cnt-1])) |
| 21781 | ✗ | sle_cnt--; | |
| 21782 | |||
| 21783 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1739 times.
|
1739 | if(sle_cnt > 0) |
| 21784 | { | ||
| 21785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1739 times.
|
1739 | if(addenemy(sle_x,sle_y,tmpscr->enemy[--sle_cnt],0)) |
| 21786 | { | ||
| 21787 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1739 times.
|
1739 | if (((enemy*)guys.spr(enemy_slot))->family != eeTEK) |
| 21788 | { | ||
| 21789 | 1739 | guys.spr(enemy_slot)->dir = dir; | |
| 21790 | 1739 | } | |
| 21791 | 1739 | } | |
| 21792 | 1739 | } | |
| 21793 | 1739 | } | |
| 21794 | |||
| 21795 |
2/2✓ Branch 0 taken 41900 times.
✓ Branch 1 taken 511 times.
|
42411 | if(sle_cnt<=0) |
| 21796 | { | ||
| 21797 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 511 times.
|
511 | if(script_sle) |
| 21798 | ✗ | script_sle = false; | |
| 21799 | 511 | else loaded_enemies=true; | |
| 21800 | 511 | sle_clk = 0; | |
| 21801 | 511 | } | |
| 21802 | 42604 | } | |
| 21803 | |||
| 21804 | 1116657 | bool is_starting_pos(int32_t i, int32_t x, int32_t y, int32_t t) | |
| 21805 | { | ||
| 21806 | |||
| 21807 |
4/4✓ Branch 0 taken 1016793 times.
✓ Branch 1 taken 99864 times.
✓ Branch 2 taken 99864 times.
✓ Branch 3 taken 1116657 times.
|
1116657 | if(tmpscr->enemy[i]<1||tmpscr->enemy[i]>=MAXGUYS) //Hackish fix for crash in Waterford.st on screen 0x65 of dmap 0 (map 1). |
| 21808 | { | ||
| 21809 | //zprint2("is_starting_pos(), tmpscr->enemy[i] is: %d\n", tmpscr->enemy[i]); | ||
| 21810 | 199728 | return false; //never 0, never OoB. | |
| 21811 | } | ||
| 21812 | // No corner enemies | ||
| 21813 |
6/6✓ Branch 0 taken 955765 times.
✓ Branch 1 taken 160892 times.
✓ Branch 2 taken 38836 times.
✓ Branch 3 taken 994601 times.
✓ Branch 4 taken 110960 times.
✓ Branch 5 taken 88768 times.
|
1116657 | if((x==0 || x==240) && (y==0 || y==160)) |
| 21814 | |||
| 21815 | 199728 | return false; | |
| 21816 | |||
| 21817 | //Is a no spawn combo... | ||
| 21818 |
3/4✓ Branch 0 taken 994597 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 994597 times.
|
994601 | if(MAPFLAG(x+8,y+8)==mfNOENEMYSPAWN || MAPCOMBOFLAG(x+8,y+8)==mfNOENEMYSPAWN) |
| 21819 | 4 | return false; | |
| 21820 | |||
| 21821 | // No enemies in dungeon walls | ||
| 21822 |
10/10✓ Branch 0 taken 632680 times.
✓ Branch 1 taken 361917 times.
✓ Branch 2 taken 561160 times.
✓ Branch 3 taken 71520 times.
✓ Branch 4 taken 489640 times.
✓ Branch 5 taken 71520 times.
✓ Branch 6 taken 403816 times.
✓ Branch 7 taken 85824 times.
✓ Branch 8 taken 85824 times.
✓ Branch 9 taken 317992 times.
|
994597 | if(isdungeon() && (x<32 || x>=224 || y<32 || y>=144)) |
| 21823 | 314688 | return false; | |
| 21824 | |||
| 21825 | // Too close | ||
| 21826 |
4/4✓ Branch 0 taken 69555 times.
✓ Branch 1 taken 610354 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 69545 times.
|
679909 | if(tooclose(x,y,40) && t<11) |
| 21827 | 69545 | return false; | |
| 21828 | |||
| 21829 | // Can't fly onto it? | ||
| 21830 |
4/4✓ Branch 0 taken 114598 times.
✓ Branch 1 taken 495766 times.
✓ Branch 2 taken 34151 times.
✓ Branch 3 taken 16220 times.
|
660735 | if(isflier(tmpscr->enemy[i])&& |
| 21831 |
2/2✓ Branch 0 taken 114380 times.
✓ Branch 1 taken 218 times.
|
114598 | (flyerblocked(x+8,y+8,spw_floater,guysbuf[tmpscr->enemy[i]])|| |
| 21832 |
2/2✓ Branch 0 taken 50371 times.
✓ Branch 1 taken 64009 times.
|
114380 | (_walkflag(x,y+8,2)&&!get_bit(quest_rules,qr_WALLFLIERS)))) |
| 21833 | 16438 | return false; | |
| 21834 | |||
| 21835 | // Can't jump onto it? | ||
| 21836 | if | ||
| 21837 | ( | ||
| 21838 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84201 times.
|
678127 | guysbuf[tmpscr->enemy[i]].family==eeTEK |
| 21839 | |||
| 21840 |
2/2✓ Branch 0 taken 84201 times.
✓ Branch 1 taken 509725 times.
|
593926 | && |
| 21841 | ( | ||
| 21842 |
1/2✓ Branch 0 taken 84201 times.
✗ Branch 1 not taken.
|
84201 | COMBOTYPE(x+8,y+8)==cNOJUMPZONE|| |
| 21843 |
1/2✓ Branch 0 taken 84201 times.
✗ Branch 1 not taken.
|
84201 | COMBOTYPE(x+8,y+8)==cNOENEMY|| |
| 21844 |
1/2✓ Branch 0 taken 84201 times.
✗ Branch 1 not taken.
|
84201 | ispitfall(x+8,y+8)|| |
| 21845 |
1/2✓ Branch 0 taken 84201 times.
✗ Branch 1 not taken.
|
84201 | MAPFLAG(x+8,y+8)==mfNOENEMY|| |
| 21846 | 84201 | MAPCOMBOFLAG(x+8,y+8)==mfNOENEMY | |
| 21847 | ) | ||
| 21848 | ) | ||
| 21849 | { | ||
| 21850 | ✗ | return false; | |
| 21851 | } | ||
| 21852 | |||
| 21853 | // Other off-limit combos | ||
| 21854 |
6/6✓ Branch 0 taken 495766 times.
✓ Branch 1 taken 98160 times.
✓ Branch 2 taken 411565 times.
✓ Branch 3 taken 84201 times.
✓ Branch 4 taken 237905 times.
✓ Branch 5 taken 173660 times.
|
1005491 | if((!isflier(tmpscr->enemy[i])&& guysbuf[tmpscr->enemy[i]].family!=eeTEK && |
| 21855 |
2/2✓ Branch 0 taken 241498 times.
✓ Branch 1 taken 170067 times.
|
411565 | (_walkflag(x,y+8,2) || groundblocked(x+8,y+8,guysbuf[tmpscr->enemy[i]]))) && |
| 21856 | 411565 | guysbuf[tmpscr->enemy[i]].family!=eeZORA) | |
| 21857 | 173660 | return false; | |
| 21858 | |||
| 21859 | // Don't ever generate enemies on these combos! | ||
| 21860 |
3/4✓ Branch 0 taken 419967 times.
✓ Branch 1 taken 299 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 419967 times.
|
420266 | if(COMBOTYPE(x+8,y+8)==cARMOS||COMBOTYPE(x+8,y+8)==cBSGRAVE) |
| 21861 | 299 | return false; | |
| 21862 | |||
| 21863 | //BS Dodongos need at least 2 spaces. | ||
| 21864 |
4/4✓ Branch 0 taken 960 times.
✓ Branch 1 taken 419007 times.
✓ Branch 2 taken 958 times.
✓ Branch 3 taken 2 times.
|
419967 | if((guysbuf[tmpscr->enemy[i]].family==eeDONGO)&&(guysbuf[tmpscr->enemy[i]].misc10==1)) |
| 21865 | { | ||
| 21866 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
2 | if(((x<16) ||_walkflag(x-16,y+8, 2))&& |
| 21867 | ✗ | ((x>224)||_walkflag(x+16,y+8, 2))&& | |
| 21868 | ✗ | ((y<16) ||_walkflag(x, y-8, 2))&& | |
| 21869 | ✗ | ((y>144)||_walkflag(x, y+24,2))) | |
| 21870 | { | ||
| 21871 | ✗ | return false; | |
| 21872 | } | ||
| 21873 | 2 | } | |
| 21874 | |||
| 21875 | 419967 | return true; | |
| 21876 | 1016793 | } | |
| 21877 | |||
| 21878 | 65664 | bool is_ceiling_pattern(int32_t i) | |
| 21879 | { | ||
| 21880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 65664 times.
|
65664 | return (i==pCEILING || i==pCEILINGR); |
| 21881 | } | ||
| 21882 | |||
| 21883 | 5548 | int32_t placeenemy(int32_t i) | |
| 21884 | { | ||
| 21885 | 5548 | std::map<int32_t, int32_t> freeposcache; | |
| 21886 | 5548 | int32_t frees = 0; | |
| 21887 | |||
| 21888 |
2/2✓ Branch 0 taken 61028 times.
✓ Branch 1 taken 5548 times.
|
66576 | for(int32_t y=0; y<176; y+=16) |
| 21889 | { | ||
| 21890 |
2/2✓ Branch 0 taken 976448 times.
✓ Branch 1 taken 61028 times.
|
1037476 | for(int32_t x=0; x<256; x+=16) |
| 21891 | { | ||
| 21892 |
3/4✓ Branch 0 taken 976448 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 394286 times.
✓ Branch 3 taken 582162 times.
|
976448 | if(is_starting_pos(i,x,y,0)) |
| 21893 | { | ||
| 21894 |
1/2✓ Branch 0 taken 394286 times.
✗ Branch 1 not taken.
|
394286 | freeposcache[frees++] = (y&0xF0)+(x>>4); |
| 21895 | 394286 | } | |
| 21896 | 976448 | } | |
| 21897 | 61028 | } | |
| 21898 | |||
| 21899 |
2/2✓ Branch 0 taken 5541 times.
✓ Branch 1 taken 7 times.
|
5548 | if(frees > 0) |
| 21900 |
2/4✓ Branch 0 taken 5541 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5541 times.
✗ Branch 3 not taken.
|
5541 | return freeposcache[zc_oldrand()%frees]; |
| 21901 | |||
| 21902 | 7 | return -1; | |
| 21903 | 5548 | } | |
| 21904 | |||
| 21905 | 33133 | void spawnEnemy(int& pos, int& clk, int& x, int& y, int& fastguys, int& i, int& guycnt, int& loadcnt) | |
| 21906 | { | ||
| 21907 | 33133 | bool placed=false; | |
| 21908 | 33133 | int32_t t=-1; | |
| 21909 | |||
| 21910 | // First: enemy combo flags | ||
| 21911 |
2/2✓ Branch 0 taken 355033 times.
✓ Branch 1 taken 31229 times.
|
386262 | for(int32_t sy=0; sy<176; sy+=16) |
| 21912 | { | ||
| 21913 |
2/2✓ Branch 0 taken 5666694 times.
✓ Branch 1 taken 353129 times.
|
6019823 | for(int32_t sx=0; sx<256; sx+=16) |
| 21914 | { | ||
| 21915 | 5666694 | int32_t cflag = MAPFLAG(sx, sy); | |
| 21916 | 5666694 | int32_t cflag_i = MAPCOMBOFLAG(sx, sy); | |
| 21917 | |||
| 21918 |
2/4✓ Branch 0 taken 5666694 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5666694 times.
✗ Branch 3 not taken.
|
5666694 | if(((cflag==mfENEMYALL)||(cflag_i==mfENEMYALL)) && (!placed)) |
| 21919 | { | ||
| 21920 | ✗ | if(!ok2add(tmpscr->enemy[i])) | |
| 21921 | { | ||
| 21922 | ✗ | if (loadcnt < 10 && tmpscr->enemy[i] > 0 && tmpscr->enemy[i] < MAXGUYS) ++loadcnt; | |
| 21923 | ✗ | } | |
| 21924 | else | ||
| 21925 | { | ||
| 21926 | ✗ | addenemy(sx, | |
| 21927 | ✗ | (is_ceiling_pattern(tmpscr->pattern) && isSideViewGravity()) ? -(150+50*guycnt) : sy, | |
| 21928 | ✗ | (is_ceiling_pattern(tmpscr->pattern) && !(isSideViewGravity())) ? 150+50*guycnt : 0,tmpscr->enemy[i],-15); | |
| 21929 | |||
| 21930 | ✗ | ++guycnt; | |
| 21931 | |||
| 21932 | ✗ | placed=true; | |
| 21933 | ✗ | goto placed_enemy; | |
| 21934 | } | ||
| 21935 | ✗ | } | |
| 21936 | |||
| 21937 |
4/4✓ Branch 0 taken 5664790 times.
✓ Branch 1 taken 1904 times.
✓ Branch 2 taken 5664790 times.
✓ Branch 3 taken 1904 times.
|
5666694 | else if(((cflag==mfENEMY0+i)||(cflag_i==mfENEMY0+i)) && (!placed)) |
| 21938 | { | ||
| 21939 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1904 times.
|
1904 | if(!ok2add(tmpscr->enemy[i])) |
| 21940 | { | ||
| 21941 | ✗ | if (loadcnt < 10 && tmpscr->enemy[i] > 0 && tmpscr->enemy[i] < MAXGUYS) ++loadcnt; | |
| 21942 | ✗ | } | |
| 21943 | else | ||
| 21944 | { | ||
| 21945 | 3808 | addenemy(sx, | |
| 21946 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1904 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1904 | (is_ceiling_pattern(tmpscr->pattern) && isSideViewGravity()) ? -(150+50*guycnt) : sy, |
| 21947 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1904 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1904 | (is_ceiling_pattern(tmpscr->pattern) && !(isSideViewGravity())) ? 150+50*guycnt : 0,tmpscr->enemy[i],-15); |
| 21948 | |||
| 21949 | 1904 | ++guycnt; | |
| 21950 | |||
| 21951 | 1904 | placed=true; | |
| 21952 | 1904 | goto placed_enemy; | |
| 21953 | } | ||
| 21954 | ✗ | } | |
| 21955 | 5664790 | } | |
| 21956 | 353129 | } | |
| 21957 | |||
| 21958 | // Next: enemy pattern | ||
| 21959 |
6/8✓ Branch 0 taken 4892 times.
✓ Branch 1 taken 26337 times.
✓ Branch 2 taken 25744 times.
✓ Branch 3 taken 5485 times.
✓ Branch 4 taken 25744 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 25744 times.
|
31229 | if((tmpscr->pattern==pRANDOM || tmpscr->pattern==pCEILING) && !(isSideViewGravity()) && ((tmpscr->enemy[i]>0&&tmpscr->enemy[i]<MAXGUYS))) |
| 21960 | { | ||
| 21961 | 25744 | do | |
| 21962 | { | ||
| 21963 | |||
| 21964 | // NES positions | ||
| 21965 | 40408 | pos%=9; | |
| 21966 | 40408 | x=stx[loadside][pos]; | |
| 21967 | 40408 | y=sty[loadside][pos]; | |
| 21968 | 40408 | ++pos; | |
| 21969 | 40408 | ++t; | |
| 21970 |
2/2✓ Branch 0 taken 14664 times.
✓ Branch 1 taken 25744 times.
|
66152 | } |
| 21971 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 40345 times.
|
40408 | while((t< 20) && !is_starting_pos(i,x,y,t)); |
| 21972 | 25744 | } | |
| 21973 | |||
| 21974 |
4/4✓ Branch 0 taken 25744 times.
✓ Branch 1 taken 5485 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 25681 times.
|
31229 | if(t<0 || t >= 20) // above enemy pattern failed |
| 21975 | { | ||
| 21976 | // Final chance: find a random position anywhere onscreen | ||
| 21977 | 5548 | int32_t randpos = placeenemy(i); | |
| 21978 | |||
| 21979 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 5541 times.
|
5548 | if(randpos>-1) |
| 21980 | { | ||
| 21981 | 5541 | x=(randpos&15)<<4; | |
| 21982 | 5541 | y= randpos&0xF0; | |
| 21983 | 5541 | } | |
| 21984 | else // All opportunities failed - abort | ||
| 21985 | { | ||
| 21986 | 7 | return; | |
| 21987 | } | ||
| 21988 | 5541 | } | |
| 21989 | |||
| 21990 | { | ||
| 21991 | 31222 | int32_t c=0; | |
| 21992 | 31222 | c=clk; | |
| 21993 | |||
| 21994 |
2/2✓ Branch 0 taken 4923 times.
✓ Branch 1 taken 26299 times.
|
31222 | if(!slowguy(tmpscr->enemy[i])) |
| 21995 | 26299 | ++fastguys; | |
| 21996 |
2/2✓ Branch 0 taken 735 times.
✓ Branch 1 taken 4188 times.
|
4923 | else if(fastguys>0) |
| 21997 | 735 | c=-15*(i-fastguys+2); | |
| 21998 | else | ||
| 21999 | 4188 | c=-15*(i+1); | |
| 22000 | |||
| 22001 |
4/6✓ Branch 0 taken 2085 times.
✓ Branch 1 taken 29137 times.
✓ Branch 2 taken 2085 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2085 times.
|
31222 | if(BSZ&&((tmpscr->enemy[i]>0&&tmpscr->enemy[i]<MAXGUYS))) // Hackish fix for crash in Waterford.qst on screen 0x65 of dmap 0 (map 1). |
| 22002 | { | ||
| 22003 | // Special case for blue leevers | ||
| 22004 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2083 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2085 | if(guysbuf[tmpscr->enemy[i]].family==eeLEV && guysbuf[tmpscr->enemy[i]].misc1==1) |
| 22005 | 2 | c=-15*(i+1); | |
| 22006 | else | ||
| 22007 | 2083 | c=-15; | |
| 22008 | 2085 | } | |
| 22009 | |||
| 22010 |
2/2✓ Branch 0 taken 30928 times.
✓ Branch 1 taken 294 times.
|
31222 | if(!ok2add(tmpscr->enemy[i])) |
| 22011 | { | ||
| 22012 |
4/6✓ Branch 0 taken 47 times.
✓ Branch 1 taken 247 times.
✓ Branch 2 taken 47 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 47 times.
|
294 | if (loadcnt < 10 && tmpscr->enemy[i] > 0 && tmpscr->enemy[i] < MAXGUYS) ++loadcnt; |
| 22013 | 294 | } | |
| 22014 | else | ||
| 22015 | { | ||
| 22016 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30928 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30928 | if(((tmpscr->enemy[i]>0||tmpscr->enemy[i]<MAXGUYS))) // Hackish fix for crash in Waterford.qst on screen 0x65 of dmap 0 (map 1). |
| 22017 | { | ||
| 22018 |
3/4✓ Branch 0 taken 83 times.
✓ Branch 1 taken 30845 times.
✓ Branch 2 taken 83 times.
✗ Branch 3 not taken.
|
61856 | addenemy(x,(is_ceiling_pattern(tmpscr->pattern) && isSideViewGravity()) ? -(150+50*guycnt) : y, |
| 22019 |
3/4✓ Branch 0 taken 83 times.
✓ Branch 1 taken 30845 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 83 times.
|
30928 | (is_ceiling_pattern(tmpscr->pattern) && !(isSideViewGravity())) ? 150+50*guycnt : 0,tmpscr->enemy[i],c); |
| 22020 | |||
| 22021 | 30928 | ++guycnt; | |
| 22022 | 30928 | } | |
| 22023 | } | ||
| 22024 | |||
| 22025 | 31222 | placed=true; | |
| 22026 | 31222 | } // if(t < 20) | |
| 22027 | |||
| 22028 | placed_enemy: | ||
| 22029 | |||
| 22030 | // I don't like this, but it seems to work... | ||
| 22031 | static bool foundCarrier; | ||
| 22032 | |||
| 22033 |
2/2✓ Branch 0 taken 25297 times.
✓ Branch 1 taken 7829 times.
|
33126 | if(i==0) |
| 22034 | 7829 | foundCarrier=false; | |
| 22035 | |||
| 22036 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33126 times.
|
33126 | if(placed) |
| 22037 | { | ||
| 22038 |
4/4✓ Branch 0 taken 7829 times.
✓ Branch 1 taken 25297 times.
✓ Branch 2 taken 7690 times.
✓ Branch 3 taken 139 times.
|
33126 | if(i==0 && tmpscr->enemyflags&efLEADER) |
| 22039 | { | ||
| 22040 | 139 | int32_t index = guys.idFirst(tmpscr->enemy[i],0xFFF); | |
| 22041 | |||
| 22042 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 7 times.
|
139 | if(index!=-1) |
| 22043 | { | ||
| 22044 | //grab the first segment. Not accurate to how older versions did it, but the way they did it might be incompatible with enemy editor. | ||
| 22045 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
132 | if ((((enemy*)guys.spr(index))->family == eeLANM) && !get_bit(quest_rules, qr_NO_LANMOLA_RINGLEADER)) index = guys.idNth(tmpscr->enemy[i], 2, 0xFFF); |
| 22046 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(index!=-1) |
| 22047 | { | ||
| 22048 | 132 | ((enemy*)guys.spr(index))->leader = true; | |
| 22049 | 132 | } | |
| 22050 | 132 | } | |
| 22051 | 139 | } | |
| 22052 | |||
| 22053 |
4/4✓ Branch 0 taken 33026 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 32997 times.
✓ Branch 3 taken 29 times.
|
33126 | if(!foundCarrier && hasitem&(4|2)) |
| 22054 | { | ||
| 22055 | 29 | int32_t index = guys.idFirst(tmpscr->enemy[i],0xFFF); | |
| 22056 | |||
| 22057 |
2/4✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29 times.
|
29 | if(index!=-1 && (((enemy*)guys.spr(index))->flags&guy_doesntcount)==0) |
| 22058 | { | ||
| 22059 | 29 | ((enemy*)guys.spr(index))->itemguy = true; | |
| 22060 | 29 | foundCarrier=true; | |
| 22061 | 29 | } | |
| 22062 | 29 | } | |
| 22063 | 33126 | } | |
| 22064 | 33133 | } | |
| 22065 | |||
| 22066 | ✗ | bool scriptloadenemies() | |
| 22067 | { | ||
| 22068 | ✗ | loaded_enemies = true; | |
| 22069 | ✗ | if(script_sle || sle_clk) return false; | |
| 22070 | ✗ | if(tmpscr->pattern==pNOSPAWN) return false; | |
| 22071 | |||
| 22072 | ✗ | if(tmpscr->pattern==pSIDES || tmpscr->pattern==pSIDESR) | |
| 22073 | { | ||
| 22074 | ✗ | script_side_load_enemies(); | |
| 22075 | ✗ | return true; | |
| 22076 | } | ||
| 22077 | |||
| 22078 | ✗ | int32_t pos=zc_oldrand()%9; | |
| 22079 | ✗ | int32_t clk=-15,x=0,y=0,fastguys=0; | |
| 22080 | ✗ | int32_t i=0,guycnt=0; | |
| 22081 | ✗ | int32_t loadcnt = 10; | |
| 22082 | |||
| 22083 | ✗ | for(; i<loadcnt && tmpscr->enemy[i]>0; i++) | |
| 22084 | { | ||
| 22085 | ✗ | spawnEnemy(pos, clk, x, y, fastguys, i, guycnt, loadcnt); | |
| 22086 | |||
| 22087 | ✗ | --clk; | |
| 22088 | ✗ | } | |
| 22089 | ✗ | return true; | |
| 22090 | ✗ | } | |
| 22091 | |||
| 22092 | 6404486 | void loadenemies() | |
| 22093 | { | ||
| 22094 |
3/4✓ Branch 0 taken 6404486 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42374 times.
✓ Branch 3 taken 6362112 times.
|
6404486 | if(script_sle || sle_clk) |
| 22095 | { | ||
| 22096 | 42374 | side_load_enemies(); | |
| 22097 | 42374 | return; | |
| 22098 | } | ||
| 22099 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6362112 times.
|
6362112 | if(tmpscr->pattern==pNOSPAWN) return; |
| 22100 |
2/2✓ Branch 0 taken 6348750 times.
✓ Branch 1 taken 13362 times.
|
6362112 | if(loaded_enemies) |
| 22101 | 6348750 | return; | |
| 22102 | |||
| 22103 | // check if it's the dungeon boss and it has been beaten before | ||
| 22104 |
4/4✓ Branch 0 taken 132 times.
✓ Branch 1 taken 13230 times.
✓ Branch 2 taken 98 times.
✓ Branch 3 taken 34 times.
|
13362 | if(tmpscr->enemyflags&efBOSS && game->lvlitems[dlevel]&liBOSS) |
| 22105 | { | ||
| 22106 | 34 | loaded_enemies = true; | |
| 22107 | 34 | return; | |
| 22108 | } | ||
| 22109 | |||
| 22110 |
4/4✓ Branch 0 taken 12991 times.
✓ Branch 1 taken 337 times.
✓ Branch 2 taken 241 times.
✓ Branch 3 taken 12750 times.
|
13328 | if(tmpscr->pattern==pSIDES || tmpscr->pattern==pSIDESR) |
| 22111 | { | ||
| 22112 | 578 | side_load_enemies(); | |
| 22113 | 578 | return; | |
| 22114 | } | ||
| 22115 | |||
| 22116 | 12750 | loaded_enemies=true; | |
| 22117 | |||
| 22118 | // do enemies that are always loaded | ||
| 22119 | 12750 | load_default_enemies(); | |
| 22120 | |||
| 22121 | // dungeon basements | ||
| 22122 | |||
| 22123 | static byte dngn_enemy_x[4] = {32,96,144,208}; | ||
| 22124 | |||
| 22125 |
2/2✓ Branch 0 taken 679 times.
✓ Branch 1 taken 12071 times.
|
12750 | if(currscr>=128) |
| 22126 | { | ||
| 22127 |
2/2✓ Branch 0 taken 339 times.
✓ Branch 1 taken 340 times.
|
679 | if(DMaps[currdmap].flags&dmfCAVES) return; |
| 22128 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 340 times.
|
340 | if ( DMaps[currdmap].flags&dmfNEWCELLARENEMIES ) |
| 22129 | { | ||
| 22130 | ✗ | for(int32_t i=0; i<10; i++) | |
| 22131 | { | ||
| 22132 | ✗ | if ( tmpscr->enemy[i] ) | |
| 22133 | { | ||
| 22134 | ✗ | addenemy(dngn_enemy_x[i],96,tmpscr->enemy[i],-14-i); | |
| 22135 | ✗ | } | |
| 22136 | ✗ | } | |
| 22137 | ✗ | } | |
| 22138 | else | ||
| 22139 | { | ||
| 22140 |
2/2✓ Branch 0 taken 1360 times.
✓ Branch 1 taken 340 times.
|
1700 | for(int32_t i=0; i<4; i++) |
| 22141 |
2/2✓ Branch 0 taken 964 times.
✓ Branch 1 taken 396 times.
|
1360 | addenemy(dngn_enemy_x[i],96,tmpscr->enemy[i]?tmpscr->enemy[i]:(int32_t)eKEESE1,-14-i); |
| 22142 | } | ||
| 22143 | 340 | return; | |
| 22144 | } | ||
| 22145 | |||
| 22146 | // check if it's been long enough to reload all enemies | ||
| 22147 | |||
| 22148 | 12071 | int32_t loadcnt = 10; | |
| 22149 | 12071 | int16_t s = (currmap<<7)+currscr; | |
| 22150 | 12071 | bool beenhere = false; | |
| 22151 | 12071 | bool reload = true; | |
| 22152 | 12071 | bool unbeatablereload = true; | |
| 22153 | |||
| 22154 |
2/2✓ Branch 0 taken 72426 times.
✓ Branch 1 taken 12071 times.
|
84497 | for(int32_t i=0; i<6; i++) |
| 22155 |
2/2✓ Branch 0 taken 68847 times.
✓ Branch 1 taken 3579 times.
|
76005 | if(visited[i]==s) |
| 22156 | 3579 | beenhere = true; | |
| 22157 | |||
| 22158 |
2/2✓ Branch 0 taken 3579 times.
✓ Branch 1 taken 8492 times.
|
12071 | if(!beenhere) //Okay so this basically checks the last 6 unique screen's you've been in and checks if the current screen is one of them. |
| 22159 | { | ||
| 22160 | 8492 | visited[vhead]=s; //If not, it adds it to the array, | |
| 22161 | 8492 | vhead = (vhead+1)%6; //which overrides one of the others, and then moves onto the next. | |
| 22162 | 8492 | } | |
| 22163 |
2/2✓ Branch 0 taken 1612 times.
✓ Branch 1 taken 1967 times.
|
3579 | else if(game->guys[s]==0) //Then, if you have been here, and the number of enemies left on the screen is 0, |
| 22164 | { | ||
| 22165 | 1967 | loadcnt = 0; //It will tell it not to load any enemies, | |
| 22166 | 1967 | reload = false; //both by setting loadcnt to 0 and making the reload if statement not run. | |
| 22167 | 1967 | } | |
| 22168 | |||
| 22169 |
2/2✓ Branch 0 taken 1967 times.
✓ Branch 1 taken 10104 times.
|
12071 | if(reload) //This if statement is only false if this screen is one of the last 6 screens you visited and you left 0 enemies alive. |
| 22170 | { | ||
| 22171 | 10104 | loadcnt = game->guys[s]; //Otherwise, if this if statement is true, it will try to load the last amount of enemies you left alive. | |
| 22172 | |||
| 22173 |
2/4✓ Branch 0 taken 3443 times.
✓ Branch 1 taken 6661 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
10104 | if(loadcnt==0 || //Then, if the number of enemies is 0, that means you left 0 enemies alive on a screen but haven't been there in the past 6 screens. |
| 22174 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3443 times.
|
3443 | (get_bit(quest_rules, qr_NO_LEAVE_ONE_ENEMY_ALIVE_TRICK) && !beenhere)) //Alternatively, if you have the quest rule enabled that always respawns all enemies after a period of time, and you haven't been here in 6 screens. |
| 22175 | 6661 | loadcnt = 10; //That means all enemies need to be respawned. | |
| 22176 |
3/4✓ Branch 0 taken 8492 times.
✓ Branch 1 taken 1612 times.
✓ Branch 2 taken 8492 times.
✗ Branch 3 not taken.
|
10104 | if (!beenhere && get_bit(quest_rules, qr_UNBEATABLES_DONT_KEEP_DEAD)) |
| 22177 | { | ||
| 22178 | ✗ | for(int32_t i = 0; i<loadcnt && tmpscr->enemy[i]>0; i++) | |
| 22179 | { | ||
| 22180 | ✗ | if (!(guysbuf[tmpscr->enemy[i]].flags & guy_doesntcount)) | |
| 22181 | { | ||
| 22182 | ✗ | unbeatablereload = false; | |
| 22183 | ✗ | } | |
| 22184 | ✗ | } | |
| 22185 | ✗ | if (unbeatablereload) | |
| 22186 | { | ||
| 22187 | ✗ | loadcnt = 10; | |
| 22188 | ✗ | } | |
| 22189 | ✗ | } | |
| 22190 | 10104 | } | |
| 22191 | |||
| 22192 |
4/4✓ Branch 0 taken 11952 times.
✓ Branch 1 taken 119 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 11902 times.
|
12071 | if((get_bit(quest_rules,qr_ALWAYSRET)) || (tmpscr->flags3&fENEMIESRETURN)) //If enemies always return is enabled quest-wide or for this screen, |
| 22193 | 169 | loadcnt = 10; //All enemies also need to be respawned. | |
| 22194 | |||
| 22195 | 12071 | int32_t pos=zc_oldrand()%9; //This sets up a variable for spawnEnemy to edit so as to spawn the enemies pseudo-randomly. | |
| 22196 | 12071 | int32_t clk=-15,x=0,y=0,fastguys=0; //clk being negative means the enemy is in it's spawn poof. | |
| 22197 | 12071 | int32_t i=0,guycnt=0; //Lastly, resets guycnt to 0 so spawnEnemy can increment it manually per-enemy. | |
| 22198 | |||
| 22199 |
4/4✓ Branch 0 taken 5560 times.
✓ Branch 1 taken 39644 times.
✓ Branch 2 taken 33133 times.
✓ Branch 3 taken 12071 times.
|
45204 | for(; i<loadcnt && tmpscr->enemy[i]>0; i++) |
| 22200 | { | ||
| 22201 | 33133 | spawnEnemy(pos, clk, x, y, fastguys, i, guycnt, loadcnt); | |
| 22202 | |||
| 22203 | 33133 | --clk; //Each additional enemy spawns with a slightly longer spawn poof than the previous. | |
| 22204 | 33133 | } | |
| 22205 | |||
| 22206 | 12071 | game->guys[s] = guycnt; | |
| 22207 | //} //if(true) | ||
| 22208 | 6404486 | } | |
| 22209 | 121 | void moneysign() | |
| 22210 | { | ||
| 22211 | 121 | additem(48,108,iRupy,ipDUMMY); | |
| 22212 | // textout(scrollbuf,get_zc_font(font_zfont),"X",64,112,CSET(0)+1); | ||
| 22213 | 121 | set_clip_state(pricesdisplaybuf, 0); | |
| 22214 | 121 | textout_ex(pricesdisplaybuf,get_zc_font(font_zfont),"X",64,112,CSET(0)+1,-1); | |
| 22215 | 121 | } | |
| 22216 | |||
| 22217 | 926 | void putprices(bool sign) | |
| 22218 | { | ||
| 22219 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 920 times.
|
926 | if(fadeclk > 0) return; |
| 22220 | // refresh what's under the prices | ||
| 22221 | // for(int32_t i=5; i<12; i++) | ||
| 22222 | // putcombo(scrollbuf,i<<4,112,tmpscr->data[112+i],tmpscr->cpage); | ||
| 22223 | |||
| 22224 | 920 | rectfill(pricesdisplaybuf, 72, 112, pricesdisplaybuf->w-1, pricesdisplaybuf->h-1, 0); | |
| 22225 | 920 | int32_t step=32; | |
| 22226 | 920 | int32_t x=80; | |
| 22227 | |||
| 22228 |
2/2✓ Branch 0 taken 147 times.
✓ Branch 1 taken 773 times.
|
920 | if(prices[2]==0) |
| 22229 | { | ||
| 22230 | 773 | step<<=1; | |
| 22231 | |||
| 22232 |
2/2✓ Branch 0 taken 753 times.
✓ Branch 1 taken 20 times.
|
773 | if(prices[1]==0) |
| 22233 | { | ||
| 22234 | 753 | x=112; | |
| 22235 | 753 | } | |
| 22236 | 773 | } | |
| 22237 | |||
| 22238 |
2/2✓ Branch 0 taken 920 times.
✓ Branch 1 taken 2760 times.
|
3680 | for(int32_t i=0; i<3; i++) |
| 22239 | { | ||
| 22240 | // Kind of stupid, but it works: 100000 is used to indicate that an item | ||
| 22241 | // has a price of zero rather than there being no item. | ||
| 22242 | // 100000 isn't a valid price, so this doesn't cause problems. | ||
| 22243 |
3/4✓ Branch 0 taken 507 times.
✓ Branch 1 taken 2253 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 507 times.
|
2760 | if(prices[i]!=0 && prices[i]<100000) |
| 22244 | { | ||
| 22245 | char buf[8]; | ||
| 22246 | 507 | sprintf(buf,sign?"%+3d":"%3d",prices[i]); | |
| 22247 | |||
| 22248 | 507 | int32_t l=(int32_t)strlen(buf); | |
| 22249 | 507 | set_clip_state(pricesdisplaybuf, 0); | |
| 22250 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 486 times.
|
507 | textout_ex(pricesdisplaybuf,get_zc_font(font_zfont),buf,x-(l>3?(l-3)<<3:0),112,CSET(0)+1,-1); |
| 22251 | 507 | } | |
| 22252 | |||
| 22253 | 2760 | x+=step; | |
| 22254 | 2760 | } | |
| 22255 | 926 | } | |
| 22256 | |||
| 22257 | // Setting up special rooms | ||
| 22258 | // Also called when the Letter is used successfully. | ||
| 22259 | 571 | void setupscreen() | |
| 22260 | { | ||
| 22261 | 571 | boughtsomething=false; | |
| 22262 | 571 | int32_t t=currscr<128?0:1; | |
| 22263 | 571 | word str=tmpscr[t].str; | |
| 22264 | |||
| 22265 | // Prices are already set to 0 in dowarp() | ||
| 22266 |
13/15✓ Branch 0 taken 86 times.
✓ Branch 1 taken 255 times.
✓ Branch 2 taken 101 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 38 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 12 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 12 times.
✓ Branch 10 taken 28 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 8 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 13 times.
|
571 | switch(tmpscr[t].room) |
| 22267 | { | ||
| 22268 | case rSP_ITEM: // special item | ||
| 22269 | 101 | additem(120,89,tmpscr[t].catchall,ipONETIME2+ipHOLDUP+ipCHECK | ((tmpscr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 22270 | 101 | break; | |
| 22271 | |||
| 22272 | case rINFO: // pay for info | ||
| 22273 | { | ||
| 22274 | 10 | int32_t count = 0; | |
| 22275 | 10 | int32_t base = 88; | |
| 22276 | 10 | int32_t step = 5; | |
| 22277 | |||
| 22278 | 10 | moneysign(); | |
| 22279 | |||
| 22280 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 30 times.
|
40 | for(int32_t i=0; i<3; i++) |
| 22281 | { | ||
| 22282 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if(QMisc.info[tmpscr[t].catchall].str[i]) |
| 22283 | { | ||
| 22284 | 30 | ++count; | |
| 22285 | 30 | } | |
| 22286 | else | ||
| 22287 | ✗ | break; | |
| 22288 | 30 | } | |
| 22289 | |||
| 22290 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if(count) |
| 22291 | { | ||
| 22292 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if(count==1) |
| 22293 | { | ||
| 22294 | ✗ | base = 88+32; | |
| 22295 | ✗ | } | |
| 22296 | |||
| 22297 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if(count==2) |
| 22298 | { | ||
| 22299 | ✗ | step = 6; | |
| 22300 | ✗ | } | |
| 22301 | |||
| 22302 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 10 times.
|
40 | for(int32_t i=0; i < count; i++) |
| 22303 | { | ||
| 22304 | 30 | additem((i << step)+base, 89, iRupy, ipMONEY + ipDUMMY); | |
| 22305 | 30 | ((item*)items.spr(items.Count()-1))->PriceIndex = i; | |
| 22306 | 30 | prices[i] = -(QMisc.info[tmpscr[t].catchall].price[i]); | |
| 22307 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if(prices[i]==0) |
| 22308 | ✗ | prices[i]=100000; // So putprices() knows there's an item here and positions the price correctly | |
| 22309 | 30 | int32_t itemid = current_item_id(itype_wealthmedal); | |
| 22310 | |||
| 22311 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | if(itemid>=0 && prices[i]!=100000) |
| 22312 | { | ||
| 22313 | ✗ | if(itemsbuf[itemid].flags & ITEM_FLAG1) | |
| 22314 | ✗ | prices[i]=((prices[i]*itemsbuf[itemid].misc1)/100); | |
| 22315 | else | ||
| 22316 | ✗ | prices[i]-=itemsbuf[itemid].misc1; | |
| 22317 | ✗ | prices[i]=vbound(prices[i], -99999, 0); | |
| 22318 | ✗ | if(prices[i]==0) | |
| 22319 | ✗ | prices[i]=100000; | |
| 22320 | ✗ | } | |
| 22321 | |||
| 22322 |
2/6✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
30 | if((QMisc.info[tmpscr[t].catchall].price[i])>1 && prices[i]>-1 && prices[i]!=100000) |
| 22323 | ✗ | prices[i]=-1; | |
| 22324 | 30 | } | |
| 22325 | 10 | } | |
| 22326 | |||
| 22327 | 10 | break; | |
| 22328 | } | ||
| 22329 | |||
| 22330 | case rMONEY: // secret money | ||
| 22331 | 38 | additem(120,89,iRupy,ipONETIME+ipDUMMY+ipMONEY); | |
| 22332 | 38 | ((item*)items.spr(items.Count()-1))->PriceIndex = 0; | |
| 22333 | 38 | break; | |
| 22334 | |||
| 22335 | case rGAMBLE: // gambling | ||
| 22336 | 6 | prices[0]=prices[1]=prices[2]=-10; | |
| 22337 | 6 | moneysign(); | |
| 22338 | 6 | additem(88,89,iRupy,ipMONEY+ipDUMMY); | |
| 22339 | 6 | ((item*)items.spr(items.Count()-1))->PriceIndex = 0; | |
| 22340 | 6 | additem(120,89,iRupy,ipMONEY+ipDUMMY); | |
| 22341 | 6 | ((item*)items.spr(items.Count()-1))->PriceIndex = 1; | |
| 22342 | 6 | additem(152,89,iRupy,ipMONEY+ipDUMMY); | |
| 22343 | 6 | ((item*)items.spr(items.Count()-1))->PriceIndex = 2; | |
| 22344 | 6 | break; | |
| 22345 | |||
| 22346 | case rREPAIR: // door repair | ||
| 22347 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | setmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 22348 | // } | ||
| 22349 | 12 | repaircharge=tmpscr[t].catchall; | |
| 22350 | 12 | break; | |
| 22351 | |||
| 22352 | case rMUPGRADE: // upgrade magic | ||
| 22353 | 1 | adjustmagic=true; | |
| 22354 | 1 | break; | |
| 22355 | |||
| 22356 | case rLEARNSLASH: // learn slash attack | ||
| 22357 | 1 | learnslash=true; | |
| 22358 | 1 | break; | |
| 22359 | |||
| 22360 | case rRP_HC: // heart container or red potion | ||
| 22361 | 12 | additem(88,89,iRPotion,ipONETIME2+ipHOLDUP+ipFADE); | |
| 22362 | 12 | ((item*)items.spr(items.Count()-1))->PriceIndex = 0; | |
| 22363 | 12 | additem(152,89,iHeartC,ipONETIME2+ipHOLDUP+ipFADE); | |
| 22364 | 12 | ((item*)items.spr(items.Count()-1))->PriceIndex = 1; | |
| 22365 | 12 | break; | |
| 22366 | |||
| 22367 | case rP_SHOP: // potion shop | ||
| 22368 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 20 times.
|
28 | if(current_item(itype_letter)<i_letter_used) |
| 22369 | { | ||
| 22370 | 8 | str=0; | |
| 22371 | 8 | break; | |
| 22372 | } | ||
| 22373 | |||
| 22374 | [[fallthrough]]; | ||
| 22375 | case rTAKEONE: // take one | ||
| 22376 | case rSHOP: // shop | ||
| 22377 | { | ||
| 22378 | 106 | int32_t count = 0; | |
| 22379 | 106 | int32_t base = 88; | |
| 22380 | 106 | int32_t step = 5; | |
| 22381 | |||
| 22382 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 105 times.
|
106 | if(tmpscr[t].room != rTAKEONE) |
| 22383 | 105 | moneysign(); | |
| 22384 | |||
| 22385 | //count and align the stuff | ||
| 22386 |
2/2✓ Branch 0 taken 95 times.
✓ Branch 1 taken 314 times.
|
409 | for(int32_t i=0; i<3; ++i) |
| 22387 | { | ||
| 22388 |
2/2✓ Branch 0 taken 303 times.
✓ Branch 1 taken 11 times.
|
314 | if(QMisc.shop[tmpscr[t].catchall].hasitem[count] != 0) |
| 22389 | { | ||
| 22390 | 303 | ++count; | |
| 22391 | 303 | } | |
| 22392 | else | ||
| 22393 | { | ||
| 22394 | 11 | break; | |
| 22395 | } | ||
| 22396 | 303 | } | |
| 22397 | |||
| 22398 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 4 times.
|
106 | if(count==1) |
| 22399 | { | ||
| 22400 | 4 | base = 88+32; | |
| 22401 | 4 | } | |
| 22402 | |||
| 22403 |
2/2✓ Branch 0 taken 99 times.
✓ Branch 1 taken 7 times.
|
106 | if(count==2) |
| 22404 | { | ||
| 22405 | 7 | step = 6; | |
| 22406 | 7 | } | |
| 22407 | |||
| 22408 |
2/2✓ Branch 0 taken 303 times.
✓ Branch 1 taken 106 times.
|
409 | for(int32_t i=0; i<count; i++) |
| 22409 | { | ||
| 22410 | 303 | additem((i<<step)+base, 89, QMisc.shop[tmpscr[t].catchall].item[i], ipHOLDUP+ipFADE+(tmpscr[t].room == rTAKEONE ? ipONETIME2 : ipCHECK)); | |
| 22411 | 303 | ((item*)items.spr(items.Count()-1))->PriceIndex = i; | |
| 22412 | |||
| 22413 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 301 times.
|
303 | if(tmpscr[t].room != rTAKEONE) |
| 22414 | { | ||
| 22415 | 301 | prices[i] = QMisc.shop[tmpscr[t].catchall].price[i]; | |
| 22416 |
1/2✓ Branch 0 taken 301 times.
✗ Branch 1 not taken.
|
301 | if(prices[i]==0) |
| 22417 | ✗ | prices[i]=100000; // So putprices() knows there's an item here and positions the price correctly | |
| 22418 | 301 | int32_t itemid = current_item_id(itype_wealthmedal); | |
| 22419 | |||
| 22420 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 301 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
301 | if(itemid>=0 && prices[i]!=100000) |
| 22421 | { | ||
| 22422 | ✗ | if(itemsbuf[itemid].flags & ITEM_FLAG1) | |
| 22423 | ✗ | prices[i]=((prices[i]*itemsbuf[itemid].misc1)/100); | |
| 22424 | else | ||
| 22425 | ✗ | prices[i]+=itemsbuf[itemid].misc1; | |
| 22426 | ✗ | prices[i]=vbound(prices[i], 0, 99999); | |
| 22427 | ✗ | if(prices[i]==0) | |
| 22428 | ✗ | prices[i]=100000; | |
| 22429 | ✗ | } | |
| 22430 | |||
| 22431 |
2/4✓ Branch 0 taken 301 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 301 times.
✗ Branch 3 not taken.
|
301 | if((QMisc.shop[tmpscr[t].catchall].price[i])>1 && prices[i]<1) |
| 22432 | ✗ | prices[i]=1; | |
| 22433 | 301 | } | |
| 22434 | 303 | } | |
| 22435 | |||
| 22436 | 106 | break; | |
| 22437 | } | ||
| 22438 | case rBOTTLESHOP: // bottle shop | ||
| 22439 | { | ||
| 22440 | ✗ | int32_t count = 0; | |
| 22441 | ✗ | int32_t base = 88; | |
| 22442 | ✗ | int32_t step = 5; | |
| 22443 | |||
| 22444 | ✗ | moneysign(); | |
| 22445 | ✗ | bottleshoptype const& bst = QMisc.bottle_shop_types[tmpscr[t].catchall]; | |
| 22446 | //count and align the stuff | ||
| 22447 | ✗ | for(int32_t i=0; i<3; ++i) | |
| 22448 | { | ||
| 22449 | ✗ | if(bst.fill[count] != 0) | |
| 22450 | { | ||
| 22451 | ✗ | ++count; | |
| 22452 | ✗ | } | |
| 22453 | else | ||
| 22454 | { | ||
| 22455 | ✗ | break; | |
| 22456 | } | ||
| 22457 | ✗ | } | |
| 22458 | |||
| 22459 | ✗ | if(count==1) | |
| 22460 | { | ||
| 22461 | ✗ | base = 88+32; | |
| 22462 | ✗ | } | |
| 22463 | |||
| 22464 | ✗ | if(count==2) | |
| 22465 | { | ||
| 22466 | ✗ | step = 6; | |
| 22467 | ✗ | } | |
| 22468 | |||
| 22469 | ✗ | for(int32_t i=0; i<count; i++) | |
| 22470 | { | ||
| 22471 | ✗ | adddummyitem((i<<step)+base, 89, /*Use item 0 as a dummy...*/0, ipHOLDUP+ipFADE+ipCHECK); | |
| 22472 | //{ Setup dummy item | ||
| 22473 | ✗ | item* curItem = ((item*)items.spr(items.Count()-1)); | |
| 22474 | ✗ | curItem->PriceIndex = i; | |
| 22475 | ✗ | newcombo const& cmb = combobuf[bst.comb[i]]; | |
| 22476 | ✗ | curItem->o_tile = cmb.o_tile; | |
| 22477 | ✗ | curItem->o_cset = bst.cset[i]; | |
| 22478 | ✗ | curItem->cs = curItem->o_cset; | |
| 22479 | ✗ | curItem->tile = cmb.o_tile; | |
| 22480 | ✗ | curItem->o_speed = cmb.speed; | |
| 22481 | ✗ | curItem->o_delay = 0; | |
| 22482 | ✗ | curItem->frames = cmb.frames; | |
| 22483 | ✗ | curItem->flip = cmb.flip; | |
| 22484 | ✗ | curItem->family = itype_bottlefill; //no pickup w/o empty bottle | |
| 22485 | ✗ | curItem->pstring = 0; | |
| 22486 | ✗ | curItem->pickup = ipHOLDUP+ipFADE+ipCHECK; | |
| 22487 | ✗ | curItem->flash = false; | |
| 22488 | ✗ | curItem->twohand = false; | |
| 22489 | ✗ | curItem->anim = true; | |
| 22490 | ✗ | curItem->hxsz=1; | |
| 22491 | ✗ | curItem->hyofs=4; | |
| 22492 | ✗ | curItem->hysz=12; | |
| 22493 | ✗ | curItem->script=0; | |
| 22494 | ✗ | curItem->txsz=1; | |
| 22495 | ✗ | curItem->tysz=1; | |
| 22496 | //} | ||
| 22497 | |||
| 22498 | ✗ | prices[i] = bst.price[i]; | |
| 22499 | ✗ | if(prices[i]==0) | |
| 22500 | ✗ | prices[i]=100000; // So putprices() knows there's an item here and positions the price correctly | |
| 22501 | ✗ | int32_t itemid = current_item_id(itype_wealthmedal); | |
| 22502 | |||
| 22503 | ✗ | if(itemid>=0 && prices[i]!=100000) | |
| 22504 | { | ||
| 22505 | ✗ | if(itemsbuf[itemid].flags & ITEM_FLAG1) | |
| 22506 | ✗ | prices[i]=((prices[i]*itemsbuf[itemid].misc1)/100); | |
| 22507 | else | ||
| 22508 | ✗ | prices[i]+=itemsbuf[itemid].misc1; | |
| 22509 | ✗ | prices[i]=vbound(prices[i], 0, 99999); | |
| 22510 | ✗ | if(prices[i]==0) | |
| 22511 | ✗ | prices[i]=100000; | |
| 22512 | ✗ | } | |
| 22513 | |||
| 22514 | ✗ | if((bst.price[i])>1 && prices[i]<1) | |
| 22515 | ✗ | prices[i]=1; | |
| 22516 | ✗ | } | |
| 22517 | |||
| 22518 | ✗ | break; | |
| 22519 | } | ||
| 22520 | |||
| 22521 | case rBOMBS: // more bombs | ||
| 22522 | 8 | additem(120,89,iRupy,ipDUMMY+ipMONEY); | |
| 22523 | 8 | ((item*)items.spr(items.Count()-1))->PriceIndex = 0; | |
| 22524 | 8 | prices[0]=-tmpscr[t].catchall; | |
| 22525 | 8 | break; | |
| 22526 | |||
| 22527 | case rARROWS: // more arrows | ||
| 22528 | ✗ | additem(120,89,iRupy,ipDUMMY+ipMONEY); | |
| 22529 | ✗ | ((item*)items.spr(items.Count()-1))->PriceIndex = 0; | |
| 22530 | ✗ | prices[0]=-tmpscr[t].catchall; | |
| 22531 | ✗ | break; | |
| 22532 | |||
| 22533 | case rSWINDLE: // leave heart container or money | ||
| 22534 | 13 | additem(88,89,iHeartC,ipDUMMY+ipMONEY); | |
| 22535 | 13 | ((item*)items.spr(items.Count()-1))->PriceIndex = 0; | |
| 22536 | 13 | prices[0]=-1; | |
| 22537 | 13 | additem(152,89,iRupy,ipDUMMY+ipMONEY); | |
| 22538 | 13 | ((item*)items.spr(items.Count()-1))->PriceIndex = 1; | |
| 22539 | 13 | prices[1]=-tmpscr[t].catchall; | |
| 22540 | 13 | break; | |
| 22541 | |||
| 22542 | } | ||
| 22543 | |||
| 22544 |
3/4✓ Branch 0 taken 563 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 563 times.
|
571 | if(tmpscr[t].room == rBOMBS || tmpscr[t].room == rARROWS) |
| 22545 | { | ||
| 22546 | 8 | int32_t i = (tmpscr[t].room == rSWINDLE ? 1 : 0); | |
| 22547 | 8 | int32_t itemid = current_item_id(itype_wealthmedal); | |
| 22548 | |||
| 22549 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(itemid >= 0) |
| 22550 | { | ||
| 22551 | ✗ | if(itemsbuf[itemid].flags & ITEM_FLAG1) | |
| 22552 | ✗ | prices[i]*=(itemsbuf[itemid].misc1/100.0); | |
| 22553 | else | ||
| 22554 | ✗ | prices[i]+=itemsbuf[itemid].misc1; | |
| 22555 | ✗ | } | |
| 22556 | |||
| 22557 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if(tmpscr[t].catchall>1 && prices[i]>-1) |
| 22558 | ✗ | prices[i]=-1; | |
| 22559 | 8 | } | |
| 22560 | |||
| 22561 | 571 | putprices(false); | |
| 22562 | |||
| 22563 |
2/2✓ Branch 0 taken 541 times.
✓ Branch 1 taken 30 times.
|
571 | if(str) |
| 22564 | { | ||
| 22565 | 541 | donewmsg(str); | |
| 22566 | 541 | } | |
| 22567 | else | ||
| 22568 | { | ||
| 22569 | 30 | Hero.unfreeze(); | |
| 22570 | } | ||
| 22571 | 571 | } | |
| 22572 | |||
| 22573 | // Increments msgptr and returns the control code argument pointed at. | ||
| 22574 | 630 | word grab_next_argument() | |
| 22575 | { | ||
| 22576 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 630 times.
|
630 | if(unsigned(msgptr+1)>=MsgStrings[msgstr].s.size()) return 0; |
| 22577 | 630 | byte val=MsgStrings[msgstr].s[++msgptr]-1; | |
| 22578 | 630 | word ret=val; | |
| 22579 | |||
| 22580 | // If an argument is succeeded by 255, then it's a three-byte argument - | ||
| 22581 | // between 254 and 65535 (or whatever the maximum actually is) | ||
| 22582 |
1/2✓ Branch 0 taken 630 times.
✗ Branch 1 not taken.
|
630 | if((unsigned(msgptr+2)<MsgStrings[msgstr].s.size()) |
| 22583 |
1/2✓ Branch 0 taken 630 times.
✗ Branch 1 not taken.
|
630 | && uint8_t(MsgStrings[msgstr].s[msgptr+1]) == 255) |
| 22584 | { | ||
| 22585 | ✗ | val=MsgStrings[msgstr].s[msgptr+2]; | |
| 22586 | ✗ | word next=val; | |
| 22587 | ✗ | ret += 254*next; | |
| 22588 | ✗ | msgptr+=2; | |
| 22589 | ✗ | } | |
| 22590 | |||
| 22591 | 630 | return ret; | |
| 22592 | 630 | } | |
| 22593 | |||
| 22594 | enum | ||
| 22595 | { | ||
| 22596 | MNU_CURSOR_TILE, MNU_CURSOR_CSET, | ||
| 22597 | MNU_CURSOR_WID, MNU_CURSOR_HEI, MNU_CURSOR_FLIP, | ||
| 22598 | |||
| 22599 | MNU_CHOSEN, MNU_TIMER, MNU_CAN_CONFIRM, | ||
| 22600 | |||
| 22601 | MNU_DATA_MAX | ||
| 22602 | }; | ||
| 22603 | struct menu_choice | ||
| 22604 | { | ||
| 22605 | int32_t x, y; | ||
| 22606 | int32_t pos; | ||
| 22607 | int32_t upos, dpos, lpos, rpos; | ||
| 22608 | ✗ | menu_choice() : x(0), y(0), pos(0), upos(0), dpos(0), lpos(0), rpos(0) | |
| 22609 | ✗ | {} | |
| 22610 | ✗ | menu_choice(int32_t x, int32_t y, int32_t pos, int32_t upos, | |
| 22611 | int32_t dpos, int32_t lpos, int32_t rpos) | ||
| 22612 | ✗ | : x(x), y(y), pos(pos), upos(upos), dpos(dpos), lpos(lpos), rpos(rpos) | |
| 22613 | ✗ | {} | |
| 22614 | }; | ||
| 22615 | static int32_t msg_menu_data[MNU_DATA_MAX]; | ||
| 22616 | static bool do_run_menu = false; | ||
| 22617 | bool do_end_str = false; | ||
| 22618 | static bool wait_advance = false; | ||
| 22619 | 33 | static std::map<int32_t, menu_choice> menu_options; | |
| 22620 | 15247 | void clr_msg_data() | |
| 22621 | { | ||
| 22622 | 15247 | do_end_str = false; | |
| 22623 | 15247 | wait_advance = false; | |
| 22624 | 15247 | do_run_menu = false; | |
| 22625 | 15247 | menu_options.clear(); | |
| 22626 | 15247 | memset(msg_menu_data, 0, sizeof(msg_menu_data)); | |
| 22627 | 15247 | } | |
| 22628 | |||
| 22629 | static bool doing_name_insert = false; | ||
| 22630 | static char namebuf[9] = {0}; | ||
| 22631 | static char* nameptr = NULL; | ||
| 22632 | static int32_t ssc_tile_hei = -1, ssc_tile_hei_buf = -1; | ||
| 22633 | ✗ | bool runMenuCursor() | |
| 22634 | { | ||
| 22635 | ✗ | clear_bitmap(msg_menu_bmp_buf); | |
| 22636 | ✗ | if(!menu_options.size()) | |
| 22637 | { | ||
| 22638 | ✗ | msg_menu_data[MNU_CHOSEN] = 0; | |
| 22639 | ✗ | return true; //end menu | |
| 22640 | } | ||
| 22641 | ✗ | int32_t pos = msg_menu_data[MNU_CHOSEN]; | |
| 22642 | //If the cursor is at an invalid pos, find the first pos >= 0... | ||
| 22643 | ✗ | if(menu_options.find(pos) == menu_options.end()) | |
| 22644 | { | ||
| 22645 | ✗ | pos = 0; | |
| 22646 | ✗ | while(menu_options.find(pos) == menu_options.end()) | |
| 22647 | ✗ | ++pos; | |
| 22648 | ✗ | } | |
| 22649 | ✗ | menu_choice* ch = &menu_options[pos]; | |
| 22650 | |||
| 22651 | ✗ | bool pressed = true; | |
| 22652 | ✗ | if(rUp()) pos = ch->upos; | |
| 22653 | ✗ | else if(rDown()) pos = ch->dpos; | |
| 22654 | ✗ | else if(rLeft()) pos = ch->lpos; | |
| 22655 | ✗ | else if(rRight()) pos = ch->rpos; | |
| 22656 | ✗ | else pressed = false; | |
| 22657 | |||
| 22658 | ✗ | if(pressed) | |
| 22659 | ✗ | msg_menu_data[MNU_TIMER] = 1; | |
| 22660 | |||
| 22661 | ✗ | bool hold_input = !((msg_menu_data[MNU_TIMER]++) % 5); | |
| 22662 | ✗ | bool held = false; | |
| 22663 | ✗ | if(hold_input) | |
| 22664 | { | ||
| 22665 | ✗ | held = true; | |
| 22666 | ✗ | if(Up()) pos = ch->upos; | |
| 22667 | ✗ | else if(Down()) pos = ch->dpos; | |
| 22668 | ✗ | else if(Left()) pos = ch->lpos; | |
| 22669 | ✗ | else if(Right()) pos = ch->rpos; | |
| 22670 | ✗ | else held = false; | |
| 22671 | ✗ | } | |
| 22672 | //If the cursor is at an invalid pos, find the first pos >= 0... | ||
| 22673 | ✗ | if(menu_options.find(pos) == menu_options.end()) | |
| 22674 | { | ||
| 22675 | ✗ | pos = 0; | |
| 22676 | ✗ | while(menu_options.find(pos) == menu_options.end()) | |
| 22677 | ✗ | ++pos; | |
| 22678 | ✗ | } | |
| 22679 | ✗ | if((pressed || held) && pos != msg_menu_data[MNU_CHOSEN]) | |
| 22680 | ✗ | sfx(MsgStrings[msgstr].sfx); | |
| 22681 | |||
| 22682 | ✗ | ch = &menu_options[pos]; | |
| 22683 | ✗ | overtileblock16(msg_menu_bmp_buf, msg_menu_data[MNU_CURSOR_TILE], | |
| 22684 | ✗ | ch->x, ch->y, (int32_t)ceil(msg_menu_data[MNU_CURSOR_WID]/16.0), | |
| 22685 | ✗ | (int32_t)ceil(msg_menu_data[MNU_CURSOR_HEI]/16.0), | |
| 22686 | ✗ | msg_menu_data[MNU_CURSOR_CSET], msg_menu_data[MNU_CURSOR_FLIP]); | |
| 22687 | |||
| 22688 | ✗ | msg_menu_data[MNU_CHOSEN] = pos; | |
| 22689 | |||
| 22690 | ✗ | if(!msg_menu_data[MNU_CAN_CONFIRM]) //Prevent instantly accepting when holding A | |
| 22691 | { | ||
| 22692 | ✗ | rAbtn(); //Eat | |
| 22693 | ✗ | if(!cAbtn()) msg_menu_data[MNU_CAN_CONFIRM] = 1; | |
| 22694 | ✗ | } | |
| 22695 | |||
| 22696 | ✗ | bool ret = (pressed || held) ? false : rAbtn(); | |
| 22697 | //Eat inputs | ||
| 22698 | ✗ | rUp(); rDown(); rLeft(); rRight(); rAbtn(); | |
| 22699 | |||
| 22700 | ✗ | if(ret) | |
| 22701 | ✗ | menu_options.clear(); | |
| 22702 | |||
| 22703 | ✗ | return ret; | |
| 22704 | //false if pos changed this frame; no confirming while moving the cursor! | ||
| 22705 | ✗ | } | |
| 22706 | |||
| 22707 | 140856 | bool bottom_margin_clip() | |
| 22708 | { | ||
| 22709 | 141156 | return !get_bit(quest_rules, qr_OLD_STRING_EDITOR_MARGINS) | |
| 22710 |
2/2✓ Branch 0 taken 300 times.
✓ Branch 1 taken 140556 times.
|
140856 | && cursor_y >= (msg_h + (get_bit(quest_rules,qr_STRING_FRAME_OLD_WIDTH_HEIGHT)?16:0) - msg_margins[down]); |
| 22711 | } | ||
| 22712 | |||
| 22713 | void update_msgstr(); | ||
| 22714 | 56753 | bool parsemsgcode() | |
| 22715 | { | ||
| 22716 |
2/2✓ Branch 0 taken 509 times.
✓ Branch 1 taken 56244 times.
|
56753 | if(msgptr>=MsgStrings[msgstr].s.size()) return false; |
| 22717 | 56244 | byte c = byte(MsgStrings[msgstr].s[msgptr]-1); | |
| 22718 |
4/38✗ Branch 0 not taken.
✓ Branch 1 taken 55914 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 301 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
|
56244 | switch(c) |
| 22719 | { | ||
| 22720 | case MSGC_NEWLINE: | ||
| 22721 | { | ||
| 22722 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); |
| 22723 | 1 | ssc_tile_hei = ssc_tile_hei_buf; | |
| 22724 | 1 | ssc_tile_hei_buf = -1; | |
| 22725 | 1 | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 22726 | 1 | cursor_x=msg_margins[left]; | |
| 22727 | 1 | return true; | |
| 22728 | } | ||
| 22729 | |||
| 22730 | case MSGC_COLOUR: | ||
| 22731 | { | ||
| 22732 | 301 | int32_t cset = (grab_next_argument()); | |
| 22733 | 301 | msgcolour = CSET(cset)+(grab_next_argument()); | |
| 22734 | 301 | return true; | |
| 22735 | } | ||
| 22736 | |||
| 22737 | case MSGC_SHDCOLOR: | ||
| 22738 | { | ||
| 22739 | ✗ | int32_t cset = (grab_next_argument()); | |
| 22740 | ✗ | msg_shdcol = CSET(cset)+(grab_next_argument()); | |
| 22741 | ✗ | return true; | |
| 22742 | } | ||
| 22743 | case MSGC_SHDTYPE: | ||
| 22744 | { | ||
| 22745 | ✗ | msg_shdtype = grab_next_argument(); | |
| 22746 | ✗ | return true; | |
| 22747 | } | ||
| 22748 | |||
| 22749 | case MSGC_SPEED: | ||
| 22750 | { | ||
| 22751 | 28 | msgspeed=grab_next_argument(); | |
| 22752 | 28 | return true; | |
| 22753 | } | ||
| 22754 | |||
| 22755 | case MSGC_CTRUP: | ||
| 22756 | { | ||
| 22757 | ✗ | int32_t a1 = grab_next_argument(); | |
| 22758 | ✗ | int32_t a2 = grab_next_argument(); | |
| 22759 | ✗ | game->change_counter(a2, a1); | |
| 22760 | ✗ | return true; | |
| 22761 | } | ||
| 22762 | |||
| 22763 | case MSGC_CTRDN: | ||
| 22764 | { | ||
| 22765 | ✗ | int32_t a1 = grab_next_argument(); | |
| 22766 | ✗ | int32_t a2 = grab_next_argument(); | |
| 22767 | ✗ | game->change_counter(-a2, a1); | |
| 22768 | ✗ | return true; | |
| 22769 | } | ||
| 22770 | |||
| 22771 | case MSGC_CTRSET: | ||
| 22772 | { | ||
| 22773 | ✗ | int32_t a1 = grab_next_argument(); | |
| 22774 | ✗ | int32_t a2 = grab_next_argument(); | |
| 22775 | ✗ | game->set_counter(vbound(a2, 0, game->get_maxcounter(a1)), a1); | |
| 22776 | ✗ | return true; | |
| 22777 | } | ||
| 22778 | |||
| 22779 | case MSGC_CTRUPPC: | ||
| 22780 | case MSGC_CTRDNPC: | ||
| 22781 | case MSGC_CTRSETPC: | ||
| 22782 | { | ||
| 22783 | ✗ | int32_t code = MsgStrings[msgstr].s[msgptr]-1; | |
| 22784 | ✗ | int32_t counter = grab_next_argument(); | |
| 22785 | ✗ | int32_t amount = grab_next_argument(); | |
| 22786 | ✗ | amount = int32_t(vbound(amount*0.01, 0.0, 1.0)*game->get_maxcounter(counter)); | |
| 22787 | |||
| 22788 | ✗ | if(code==MSGC_CTRDNPC) | |
| 22789 | ✗ | amount*=-1; | |
| 22790 | |||
| 22791 | ✗ | if(code==MSGC_CTRSETPC) | |
| 22792 | ✗ | game->set_counter(amount, counter); | |
| 22793 | else | ||
| 22794 | ✗ | game->change_counter(amount, counter); | |
| 22795 | |||
| 22796 | ✗ | return true; | |
| 22797 | } | ||
| 22798 | |||
| 22799 | case MSGC_GIVEITEM: | ||
| 22800 | { | ||
| 22801 | ✗ | int32_t itemID = grab_next_argument(); | |
| 22802 | |||
| 22803 | ✗ | getitem(itemID, true); | |
| 22804 | ✗ | if ( !item_doscript[itemID] && (((unsigned)itemID) < 256) ) | |
| 22805 | { | ||
| 22806 | ✗ | itemScriptData[itemID].Clear(); | |
| 22807 | ✗ | memset(item_stack[itemID], 0xFFFF, MAX_SCRIPT_REGISTERS * sizeof(int32_t)); | |
| 22808 | ✗ | if ( (itemsbuf[itemID].flags&ITEM_PASSIVESCRIPT) ) item_doscript[itemID] = 1; | |
| 22809 | ✗ | } | |
| 22810 | ✗ | return true; | |
| 22811 | } | ||
| 22812 | |||
| 22813 | |||
| 22814 | case MSGC_WARP: | ||
| 22815 | { | ||
| 22816 | ✗ | int32_t dmap = grab_next_argument(); | |
| 22817 | ✗ | int32_t scrn = grab_next_argument(); | |
| 22818 | ✗ | int32_t dx = grab_next_argument(); | |
| 22819 | ✗ | int32_t dy = grab_next_argument(); | |
| 22820 | ✗ | int32_t wfx = grab_next_argument(); | |
| 22821 | ✗ | int32_t sfx = grab_next_argument(); | |
| 22822 | ✗ | if(dx >= MAX_SCC_ARG) dx = -1; | |
| 22823 | ✗ | if(dy >= MAX_SCC_ARG) dy = -1; | |
| 22824 | ✗ | FFCore.warp_player(wtIWARP, dmap, scrn, dx, dy, wfx, sfx, warpFlagDONTKILLMUSIC, 0); | |
| 22825 | ✗ | return true; | |
| 22826 | } | ||
| 22827 | |||
| 22828 | case MSGC_SETSCREEND: | ||
| 22829 | { | ||
| 22830 | ✗ | int32_t dmap = (grab_next_argument()<<7); //dmap and screen may be transposed here. | |
| 22831 | ✗ | int32_t screen = grab_next_argument(); | |
| 22832 | ✗ | int32_t reg = grab_next_argument(); | |
| 22833 | ✗ | int32_t val = grab_next_argument(); | |
| 22834 | ✗ | FFCore.set_screen_d(screen + dmap, reg, val); | |
| 22835 | ✗ | return true; | |
| 22836 | } | ||
| 22837 | case MSGC_TAKEITEM: | ||
| 22838 | { | ||
| 22839 | ✗ | int32_t itemID = grab_next_argument(); | |
| 22840 | ✗ | if ( item_doscript[itemID] ) | |
| 22841 | { | ||
| 22842 | ✗ | item_doscript[itemID] = 4; //Val of 4 means 'clear stack and quit' | |
| 22843 | ✗ | } | |
| 22844 | ✗ | takeitem(itemID); | |
| 22845 | ✗ | if ( game->forced_bwpn == itemID ) | |
| 22846 | { | ||
| 22847 | ✗ | game->forced_bwpn = -1; | |
| 22848 | ✗ | } //not else if! -Z | |
| 22849 | ✗ | if ( game->forced_awpn == itemID ) | |
| 22850 | { | ||
| 22851 | ✗ | game->forced_awpn = -1; | |
| 22852 | ✗ | } | |
| 22853 | ✗ | if ( game->forced_xwpn == itemID ) | |
| 22854 | { | ||
| 22855 | ✗ | game->forced_xwpn = -1; | |
| 22856 | ✗ | } //not else if! -Z | |
| 22857 | ✗ | if ( game->forced_ywpn == itemID ) | |
| 22858 | { | ||
| 22859 | ✗ | game->forced_ywpn = -1; | |
| 22860 | ✗ | } | |
| 22861 | ✗ | verifyBothWeapons(); | |
| 22862 | ✗ | return true; | |
| 22863 | } | ||
| 22864 | |||
| 22865 | case MSGC_SFX: | ||
| 22866 | { | ||
| 22867 | ✗ | sfx((int32_t)grab_next_argument(),128); | |
| 22868 | ✗ | return true; | |
| 22869 | } | ||
| 22870 | |||
| 22871 | case MSGC_MIDI: | ||
| 22872 | { | ||
| 22873 | ✗ | int32_t music = (int32_t)(grab_next_argument()); | |
| 22874 | |||
| 22875 | ✗ | if(music==0) | |
| 22876 | ✗ | music_stop(); | |
| 22877 | else | ||
| 22878 | ✗ | jukebox(music+(ZC_MIDI_COUNT-1)); | |
| 22879 | |||
| 22880 | ✗ | return true; | |
| 22881 | } | ||
| 22882 | |||
| 22883 | case MSGC_NAME: | ||
| 22884 | { | ||
| 22885 | ✗ | doing_name_insert = true; | |
| 22886 | ✗ | sprintf(namebuf, "%s", game->get_name()); | |
| 22887 | ✗ | nameptr = namebuf; | |
| 22888 | ✗ | return true; | |
| 22889 | } | ||
| 22890 | |||
| 22891 | case MSGC_FONT: | ||
| 22892 | { | ||
| 22893 | ✗ | int fontid = grab_next_argument(); | |
| 22894 | ✗ | int oh = text_height(msgfont); | |
| 22895 | ✗ | msgfont = get_zc_font(fontid); | |
| 22896 | ✗ | int nh = text_height(msgfont); | |
| 22897 | ✗ | int mh = std::max(oh,nh); | |
| 22898 | ✗ | if(mh > ssc_tile_hei_buf) | |
| 22899 | ✗ | ssc_tile_hei_buf = mh; | |
| 22900 | ✗ | return true; | |
| 22901 | } | ||
| 22902 | case MSGC_RUN_FRZ_GENSCR: | ||
| 22903 | { | ||
| 22904 | ✗ | word scr_id = grab_next_argument(); | |
| 22905 | ✗ | bool force_redraw = grab_next_argument()!=0; | |
| 22906 | ✗ | if(force_redraw) | |
| 22907 | { | ||
| 22908 | ✗ | update_msgstr(); | |
| 22909 | ✗ | draw_screen(tmpscr); | |
| 22910 | ✗ | } | |
| 22911 | ✗ | FFCore.runGenericFrozenEngine(scr_id); | |
| 22912 | ✗ | return true; | |
| 22913 | } | ||
| 22914 | case MSGC_DRAWTILE: | ||
| 22915 | { | ||
| 22916 | ✗ | int32_t tl = grab_next_argument(); | |
| 22917 | ✗ | int32_t cs = grab_next_argument(); | |
| 22918 | ✗ | int32_t t_wid = grab_next_argument(); | |
| 22919 | ✗ | int32_t t_hei = grab_next_argument(); | |
| 22920 | ✗ | int32_t fl = grab_next_argument(); | |
| 22921 | |||
| 22922 | ✗ | if(cursor_x+MsgStrings[msgstr].hspace + t_wid > msg_w-msg_margins[right]) | |
| 22923 | { | ||
| 22924 | ✗ | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); | |
| 22925 | ✗ | ssc_tile_hei = ssc_tile_hei_buf; | |
| 22926 | ✗ | ssc_tile_hei_buf = -1; | |
| 22927 | ✗ | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 22928 | ✗ | if(bottom_margin_clip()) return true; | |
| 22929 | ✗ | cursor_x=msg_margins[left]; | |
| 22930 | ✗ | } | |
| 22931 | |||
| 22932 | ✗ | overtileblock16(msg_txt_bmp_buf, tl, cursor_x, cursor_y, (int32_t)ceil(t_wid/16.0), (int32_t)ceil(t_hei/16.0), cs, fl); | |
| 22933 | ✗ | ssc_tile_hei_buf = zc_max(ssc_tile_hei_buf, t_hei); | |
| 22934 | ✗ | cursor_x += MsgStrings[msgstr].hspace + t_wid; | |
| 22935 | ✗ | return true; | |
| 22936 | } | ||
| 22937 | |||
| 22938 | case MSGC_GOTOIFRAND: | ||
| 22939 | { | ||
| 22940 | ✗ | int32_t odds = (int32_t)(grab_next_argument()); | |
| 22941 | |||
| 22942 | ✗ | if(!odds || !(zc_oldrand()%odds)) | |
| 22943 | ✗ | goto switched; | |
| 22944 | |||
| 22945 | ✗ | (void)grab_next_argument(); | |
| 22946 | ✗ | return true; | |
| 22947 | } | ||
| 22948 | |||
| 22949 | case MSGC_GOTOIFGLOBAL: | ||
| 22950 | { | ||
| 22951 | ✗ | int32_t arg = (int32_t)grab_next_argument(); | |
| 22952 | ✗ | int32_t d = zc_min(7,arg); | |
| 22953 | ✗ | int32_t s = ((get_currdmap())<<7) + get_currscr()-(DMaps[get_currdmap()].type==dmOVERW ? 0 : DMaps[get_currdmap()].xoff); | |
| 22954 | ✗ | arg = (int32_t)grab_next_argument(); | |
| 22955 | |||
| 22956 | ✗ | if(game->screen_d[s][d] >= arg) | |
| 22957 | ✗ | goto switched; | |
| 22958 | |||
| 22959 | ✗ | (void)grab_next_argument(); | |
| 22960 | ✗ | return true; | |
| 22961 | } | ||
| 22962 | |||
| 22963 | case MSGC_CHANGEPORTRAIT: | ||
| 22964 | { | ||
| 22965 | ✗ | return true; //not implemented | |
| 22966 | } | ||
| 22967 | |||
| 22968 | case MSGC_GOTOIFCREEND: | ||
| 22969 | { | ||
| 22970 | ✗ | int32_t dmap = (grab_next_argument()<<7); //dmap and screen may be transposed here. | |
| 22971 | ✗ | int32_t screen = grab_next_argument(); | |
| 22972 | ✗ | int32_t reg = grab_next_argument(); | |
| 22973 | ✗ | int32_t val = grab_next_argument(); | |
| 22974 | //int32_t nxtstr = grab_next_argument(); | ||
| 22975 | ✗ | if ( FFCore.get_screen_d(screen + dmap, reg) >= val ) | |
| 22976 | { | ||
| 22977 | ✗ | goto switched; | |
| 22978 | } | ||
| 22979 | ✗ | (void)grab_next_argument(); | |
| 22980 | ✗ | return true; | |
| 22981 | } | ||
| 22982 | |||
| 22983 | case MSGC_GOTOIF: | ||
| 22984 | { | ||
| 22985 | ✗ | int32_t it = (int32_t)grab_next_argument(); | |
| 22986 | |||
| 22987 | ✗ | if(unsigned(it)<MAXITEMS && game->item[it]) | |
| 22988 | ✗ | goto switched; | |
| 22989 | |||
| 22990 | ✗ | (void)grab_next_argument(); | |
| 22991 | ✗ | return true; | |
| 22992 | } | ||
| 22993 | |||
| 22994 | case MSGC_GOTOIFCTR: | ||
| 22995 | { | ||
| 22996 | ✗ | if(game->get_counter(grab_next_argument())>=grab_next_argument()) | |
| 22997 | ✗ | goto switched; | |
| 22998 | |||
| 22999 | ✗ | (void)grab_next_argument(); | |
| 23000 | ✗ | return true; | |
| 23001 | } | ||
| 23002 | |||
| 23003 | case MSGC_GOTOIFCTRPC: | ||
| 23004 | { | ||
| 23005 | ✗ | int32_t counter = grab_next_argument(); | |
| 23006 | ✗ | int32_t amount = (int32_t)(((grab_next_argument())/100)*game->get_maxcounter(counter)); | |
| 23007 | |||
| 23008 | ✗ | if(game->get_counter(counter)>=amount) | |
| 23009 | ✗ | goto switched; | |
| 23010 | |||
| 23011 | ✗ | (void)grab_next_argument(); | |
| 23012 | ✗ | return true; | |
| 23013 | } | ||
| 23014 | |||
| 23015 | case MSGC_GOTOIFTRICOUNT: | ||
| 23016 | { | ||
| 23017 | ✗ | if(TriforceCount() >= (int32_t)(grab_next_argument())) | |
| 23018 | ✗ | goto switched; | |
| 23019 | |||
| 23020 | ✗ | (void)grab_next_argument(); | |
| 23021 | ✗ | return true; | |
| 23022 | } | ||
| 23023 | |||
| 23024 | case MSGC_GOTOIFTRI: | ||
| 23025 | { | ||
| 23026 | ✗ | int32_t lev = (int32_t)(grab_next_argument()); | |
| 23027 | |||
| 23028 | ✗ | if(lev<MAXLEVELS && game->lvlitems[lev]&liTRIFORCE) | |
| 23029 | ✗ | goto switched; | |
| 23030 | |||
| 23031 | ✗ | (void)grab_next_argument(); | |
| 23032 | ✗ | return true; | |
| 23033 | } | ||
| 23034 | |||
| 23035 | case MSGC_SETUPMENU: | ||
| 23036 | { | ||
| 23037 | ✗ | msg_menu_data[MNU_CURSOR_TILE] = grab_next_argument(); | |
| 23038 | ✗ | msg_menu_data[MNU_CURSOR_CSET] = grab_next_argument(); | |
| 23039 | ✗ | msg_menu_data[MNU_CURSOR_WID] = grab_next_argument(); | |
| 23040 | ✗ | msg_menu_data[MNU_CURSOR_HEI] = grab_next_argument(); | |
| 23041 | ✗ | msg_menu_data[MNU_CURSOR_FLIP] = grab_next_argument(); | |
| 23042 | ✗ | return true; | |
| 23043 | } | ||
| 23044 | |||
| 23045 | case MSGC_MENUCHOICE: | ||
| 23046 | { | ||
| 23047 | ✗ | int32_t pos = grab_next_argument(); | |
| 23048 | ✗ | int32_t upos = grab_next_argument(); | |
| 23049 | ✗ | int32_t dpos = grab_next_argument(); | |
| 23050 | ✗ | int32_t lpos = grab_next_argument(); | |
| 23051 | ✗ | int32_t rpos = grab_next_argument(); | |
| 23052 | ✗ | if(cursor_x+MsgStrings[msgstr].hspace + msg_menu_data[MNU_CURSOR_WID] > msg_w-msg_margins[right]) | |
| 23053 | { | ||
| 23054 | ✗ | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); | |
| 23055 | ✗ | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23056 | ✗ | ssc_tile_hei_buf = -1; | |
| 23057 | ✗ | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23058 | ✗ | if(bottom_margin_clip()) break; | |
| 23059 | ✗ | cursor_x=msg_margins[left]; | |
| 23060 | ✗ | } | |
| 23061 | |||
| 23062 | ✗ | menu_options[pos] = menu_choice(cursor_x, cursor_y, pos, | |
| 23063 | ✗ | upos, dpos, lpos, rpos); | |
| 23064 | |||
| 23065 | ✗ | ssc_tile_hei_buf = zc_max(ssc_tile_hei_buf, msg_menu_data[MNU_CURSOR_HEI]); | |
| 23066 | ✗ | cursor_x += MsgStrings[msgstr].hspace + msg_menu_data[MNU_CURSOR_WID]; | |
| 23067 | ✗ | return true; | |
| 23068 | } | ||
| 23069 | |||
| 23070 | case MSGC_RUNMENU: | ||
| 23071 | { | ||
| 23072 | ✗ | msg_menu_data[MNU_CHOSEN] = 0; | |
| 23073 | ✗ | msg_menu_data[MNU_CAN_CONFIRM] = 0; | |
| 23074 | ✗ | if(menu_options.size() < 1) | |
| 23075 | ✗ | return true; | |
| 23076 | ✗ | do_run_menu = true; | |
| 23077 | ✗ | return true; | |
| 23078 | } | ||
| 23079 | |||
| 23080 | case MSGC_GOTOMENUCHOICE: | ||
| 23081 | { | ||
| 23082 | ✗ | int32_t choice = grab_next_argument(); | |
| 23083 | ✗ | if(msg_menu_data[MNU_CHOSEN] == choice) | |
| 23084 | ✗ | goto switched; | |
| 23085 | ✗ | (void)grab_next_argument(); | |
| 23086 | ✗ | return true; | |
| 23087 | } | ||
| 23088 | |||
| 23089 | case MSGC_ENDSTRING: | ||
| 23090 | { | ||
| 23091 | ✗ | do_end_str = true; | |
| 23092 | ✗ | return true; | |
| 23093 | } | ||
| 23094 | case MSGC_WAIT_ADVANCE: | ||
| 23095 | { | ||
| 23096 | ✗ | wait_advance = true; | |
| 23097 | ✗ | linkedmsgclk = 51; | |
| 23098 | ✗ | return true; | |
| 23099 | } | ||
| 23100 | case MSGC_TRIGSECRETS: | ||
| 23101 | { | ||
| 23102 | ✗ | bool perm = (bool)grab_next_argument(); | |
| 23103 | ✗ | hidden_entrance(0, true, false, -8); | |
| 23104 | ✗ | if(perm) | |
| 23105 | ✗ | setmapflag(mSECRET); | |
| 23106 | ✗ | return true; | |
| 23107 | } | ||
| 23108 | case MSGC_SETSCREENSTATE: | ||
| 23109 | { | ||
| 23110 | ✗ | int32_t flag = int32_t(grab_next_argument()); | |
| 23111 | ✗ | if(unsigned(flag)>=mMAXIND) | |
| 23112 | { | ||
| 23113 | ✗ | Z_error("SCC 133: Flag %d is invalid\n", flag); | |
| 23114 | ✗ | return true; | |
| 23115 | } | ||
| 23116 | ✗ | bool state = bool(grab_next_argument()); | |
| 23117 | ✗ | if(state) | |
| 23118 | ✗ | setmapflag(1<<flag); | |
| 23119 | else | ||
| 23120 | ✗ | unsetmapflag(1<<flag,true); | |
| 23121 | ✗ | return true; | |
| 23122 | } | ||
| 23123 | case MSGC_SETSCREENSTATER: | ||
| 23124 | { | ||
| 23125 | ✗ | int32_t map = (int32_t)grab_next_argument(); | |
| 23126 | ✗ | int32_t scrid = (int32_t)grab_next_argument(); | |
| 23127 | ✗ | if(map < 1 || map > map_count) | |
| 23128 | { | ||
| 23129 | ✗ | Z_error("SCC 134: Map %d is invalid\n", map); | |
| 23130 | ✗ | return true; | |
| 23131 | } | ||
| 23132 | ✗ | if(unsigned(scrid)>=0x80) | |
| 23133 | { | ||
| 23134 | ✗ | Z_error("SCC 134: Screen %d is invalid\n", scrid); | |
| 23135 | ✗ | return true; | |
| 23136 | } | ||
| 23137 | |||
| 23138 | ✗ | int32_t flag = int32_t(grab_next_argument()); | |
| 23139 | ✗ | if(unsigned(flag)>=mMAXIND) | |
| 23140 | { | ||
| 23141 | ✗ | Z_error("SCC 134: Flag %d is invalid\n", flag); | |
| 23142 | ✗ | return true; | |
| 23143 | } | ||
| 23144 | ✗ | bool state = bool(grab_next_argument()); | |
| 23145 | ✗ | if(state) | |
| 23146 | ✗ | setmapflag(mapind(map,scrid),1<<flag); | |
| 23147 | else | ||
| 23148 | ✗ | unsetmapflag(mapind(map,scrid),1<<flag,true); | |
| 23149 | ✗ | return true; | |
| 23150 | } | ||
| 23151 | switched: | ||
| 23152 | ✗ | int32_t lev = (int32_t)(grab_next_argument()); | |
| 23153 | ✗ | if(lev && get_bit(quest_rules, qr_SCC_GOTO_RESPECTS_CONTFLAG) | |
| 23154 | ✗ | && (MsgStrings[lev].stringflags & STRINGFLAG_CONT)) | |
| 23155 | { | ||
| 23156 | ✗ | msgstr=lev; | |
| 23157 | ✗ | msgpos=msgptr=0; | |
| 23158 | ✗ | msgfont=setmsgfont(); | |
| 23159 | ✗ | } | |
| 23160 | ✗ | else donewmsg(lev); | |
| 23161 | ✗ | msgptr--; // To counteract it being incremented after this routine is called. | |
| 23162 | ✗ | putprices(false); | |
| 23163 | ✗ | return true; | |
| 23164 | } | ||
| 23165 | |||
| 23166 | 55914 | return false; | |
| 23167 | 56753 | } | |
| 23168 | |||
| 23169 | // Wraps the message string... probably. | ||
| 23170 | 54992 | void wrapmsgstr(char *s3) | |
| 23171 | { | ||
| 23172 | 54992 | int32_t j=0; | |
| 23173 | |||
| 23174 |
2/2✓ Branch 0 taken 9679 times.
✓ Branch 1 taken 45313 times.
|
54992 | if(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP) |
| 23175 | { | ||
| 23176 |
2/2✓ Branch 0 taken 2081 times.
✓ Branch 1 taken 7598 times.
|
9679 | if(msgspace) |
| 23177 | { | ||
| 23178 | 2081 | char c = MsgStrings[msgstr].s[msgptr]; | |
| 23179 |
4/6✓ Branch 0 taken 1786 times.
✓ Branch 1 taken 295 times.
✓ Branch 2 taken 1786 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1786 times.
✗ Branch 5 not taken.
|
2081 | if(c != ' ' && c >= 32 && c <= 126) |
| 23180 | { | ||
| 23181 |
4/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 9806 times.
✓ Branch 2 taken 8026 times.
✓ Branch 3 taken 1786 times.
|
9812 | for(int32_t k=0; MsgStrings[msgstr].s[msgptr+k] && MsgStrings[msgstr].s[msgptr+k] != ' '; k++) |
| 23182 | { | ||
| 23183 |
3/4✓ Branch 0 taken 7734 times.
✓ Branch 1 taken 292 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7734 times.
|
8026 | if(MsgStrings[msgstr].s[msgptr+k] >= 32 && MsgStrings[msgstr].s[msgptr+k] <= 126) s3[j++] = MsgStrings[msgstr].s[msgptr+k]; |
| 23184 | 8026 | } | |
| 23185 | |||
| 23186 | 1786 | s3[j] = 0; | |
| 23187 | 1786 | msgspace = false; | |
| 23188 | 1786 | } | |
| 23189 | else | ||
| 23190 | { | ||
| 23191 | 295 | s3[0] = c; | |
| 23192 | 295 | s3[1] = 0; | |
| 23193 | } | ||
| 23194 | 2081 | } | |
| 23195 | else | ||
| 23196 | { | ||
| 23197 | 7598 | s3[0] = MsgStrings[msgstr].s[msgptr]; | |
| 23198 | 7598 | s3[1] = 0; | |
| 23199 | |||
| 23200 |
2/2✓ Branch 0 taken 5948 times.
✓ Branch 1 taken 1650 times.
|
7598 | if(s3[0] == ' ') msgspace=true; |
| 23201 | } | ||
| 23202 | 9679 | } | |
| 23203 | else | ||
| 23204 | { | ||
| 23205 | 45313 | s3[0] = MsgStrings[msgstr].s[msgptr]; | |
| 23206 | 45313 | s3[1] = 0; | |
| 23207 | } | ||
| 23208 | 54992 | } | |
| 23209 | |||
| 23210 | // Returns true if the pointer is at a string's | ||
| 23211 | // null terminator or a trailing space | ||
| 23212 | 165680 | bool atend(char const* str) | |
| 23213 | { | ||
| 23214 | 165680 | int32_t i=0; | |
| 23215 | |||
| 23216 |
2/2✓ Branch 0 taken 1408350 times.
✓ Branch 1 taken 165680 times.
|
1574030 | while(str[i]==' ') |
| 23217 | 1408350 | i++; | |
| 23218 | |||
| 23219 | 165680 | return str[i]=='\0'; | |
| 23220 | } | ||
| 23221 | |||
| 23222 | 6439258 | void putmsg() | |
| 23223 | { | ||
| 23224 | 6439258 | bool oldmargin = get_bit(quest_rules, qr_OLD_STRING_EDITOR_MARGINS)!=0; | |
| 23225 |
2/2✓ Branch 0 taken 6254567 times.
✓ Branch 1 taken 184691 times.
|
6439258 | if(!msgorig) msgorig=msgstr; |
| 23226 | |||
| 23227 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6439258 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6439258 | if(wait_advance && linkedmsgclk < 1) |
| 23228 | ✗ | linkedmsgclk = 1; | |
| 23229 |
2/2✓ Branch 0 taken 6399533 times.
✓ Branch 1 taken 39725 times.
|
6439258 | if(linkedmsgclk>0) |
| 23230 | { | ||
| 23231 |
2/2✓ Branch 0 taken 14274 times.
✓ Branch 1 taken 25451 times.
|
39725 | if(linkedmsgclk==1) |
| 23232 | { | ||
| 23233 |
5/6✓ Branch 0 taken 14274 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13849 times.
✓ Branch 3 taken 425 times.
✓ Branch 4 taken 84 times.
✓ Branch 5 taken 13765 times.
|
14274 | if(do_end_str||cAbtn()||cBbtn()) |
| 23234 | { | ||
| 23235 | 509 | do_end_str = false; | |
| 23236 | 509 | linkedmsgclk = 0; | |
| 23237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 509 times.
|
509 | if(wait_advance) |
| 23238 | { | ||
| 23239 | ✗ | wait_advance = false; | |
| 23240 | ✗ | } | |
| 23241 | else | ||
| 23242 | { | ||
| 23243 | 509 | msgstr=MsgStrings[msgstr].nextstring; | |
| 23244 |
3/4✓ Branch 0 taken 168 times.
✓ Branch 1 taken 341 times.
✓ Branch 2 taken 168 times.
✗ Branch 3 not taken.
|
509 | if(!msgstr && enqueued_str) |
| 23245 | { | ||
| 23246 | ✗ | msgstr = enqueued_str; | |
| 23247 | ✗ | enqueued_str = 0; | |
| 23248 | ✗ | } | |
| 23249 |
2/2✓ Branch 0 taken 341 times.
✓ Branch 1 taken 168 times.
|
509 | if(!msgstr) |
| 23250 | { | ||
| 23251 | 168 | msgfont=get_zc_font(font_zfont); | |
| 23252 | |||
| 23253 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 168 times.
|
168 | if(tmpscr->room!=rGRUMBLE) |
| 23254 | 168 | blockpath=false; | |
| 23255 | |||
| 23256 | 168 | dismissmsg(); | |
| 23257 | 168 | goto disappear; | |
| 23258 | } | ||
| 23259 | |||
| 23260 | 341 | donewmsg(msgstr); | |
| 23261 | 341 | putprices(false); | |
| 23262 | } | ||
| 23263 | 341 | } | |
| 23264 | 14106 | } | |
| 23265 | else | ||
| 23266 | { | ||
| 23267 | 25451 | --linkedmsgclk; | |
| 23268 | } | ||
| 23269 | 39557 | } | |
| 23270 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6439090 times.
|
6439090 | if(wait_advance) return; //Waiting for buttonpress |
| 23271 | |||
| 23272 |
9/10✓ Branch 0 taken 6438978 times.
✓ Branch 1 taken 112 times.
✓ Branch 2 taken 183725 times.
✓ Branch 3 taken 6255253 times.
✓ Branch 4 taken 123316 times.
✓ Branch 5 taken 60409 times.
✓ Branch 6 taken 63175 times.
✓ Branch 7 taken 60141 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 63175 times.
|
6439090 | if(!do_run_menu && (!msgstr || msgpos>=10000 || msgptr>=MsgStrings[msgstr].s.size() || bottom_margin_clip())) |
| 23273 | { | ||
| 23274 |
2/2✓ Branch 0 taken 120550 times.
✓ Branch 1 taken 6255253 times.
|
6375803 | if(!msgstr) |
| 23275 | 6255253 | msgorig=0; | |
| 23276 | |||
| 23277 | 6375803 | msg_active = false; | |
| 23278 | 6375803 | return; | |
| 23279 | } | ||
| 23280 | |||
| 23281 | 63287 | msg_onscreen = true; // Now the message is onscreen (see donewmsg()). | |
| 23282 | |||
| 23283 | char s3[145]; | ||
| 23284 | int32_t tlength; | ||
| 23285 | |||
| 23286 | // Bypass the string with the B button! | ||
| 23287 |
4/4✓ Branch 0 taken 321 times.
✓ Branch 1 taken 62966 times.
✓ Branch 2 taken 348 times.
✓ Branch 3 taken 62618 times.
|
63287 | if(((cBbtn())&&(get_bit(quest_rules,qr_ALLOWMSGBYPASS))) || msgspeed==0) |
| 23288 | { | ||
| 23289 | //finish writing out the string | ||
| 23290 |
4/4✓ Branch 0 taken 31 times.
✓ Branch 1 taken 36028 times.
✓ Branch 2 taken 557 times.
✓ Branch 3 taken 35502 times.
|
36169 | while(msgptr<MsgStrings[msgstr].s.size() && !atend(MsgStrings[msgstr].s.c_str()+msgptr)) |
| 23291 | { | ||
| 23292 |
4/6✓ Branch 0 taken 17002 times.
✓ Branch 1 taken 18500 times.
✓ Branch 2 taken 17002 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17002 times.
✗ Branch 5 not taken.
|
35502 | if(msgspeed && !(cBbtn() && get_bit(quest_rules,qr_ALLOWMSGBYPASS))) |
| 23293 | ✗ | goto breakout; // break out if message speed was changed to non-zero | |
| 23294 |
5/6✓ Branch 0 taken 35500 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 35500 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 234 times.
✓ Branch 5 taken 35266 times.
|
35502 | else if(!do_run_menu && !doing_name_insert && !parsemsgcode()) |
| 23295 | { | ||
| 23296 |
1/2✓ Branch 0 taken 35266 times.
✗ Branch 1 not taken.
|
35266 | if(bottom_margin_clip()) |
| 23297 | ✗ | break; | |
| 23298 | |||
| 23299 | 35266 | wrapmsgstr(s3); | |
| 23300 | |||
| 23301 |
2/2✓ Branch 0 taken 8524 times.
✓ Branch 1 taken 26742 times.
|
35266 | if(MsgStrings[msgstr].s[msgptr]==' ') |
| 23302 | { | ||
| 23303 | 8524 | tlength = msgfont->vtable->char_length(msgfont, MsgStrings[msgstr].s[msgptr]) + MsgStrings[msgstr].hspace; | |
| 23304 | |||
| 23305 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 388 times.
|
8955 | if(cursor_x+tlength > (msg_w-msg_margins[right]) |
| 23306 |
5/6✓ Branch 0 taken 431 times.
✓ Branch 1 taken 8093 times.
✓ Branch 2 taken 431 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 429 times.
✓ Branch 5 taken 41 times.
|
8524 | && ((cursor_x > (msg_w-msg_margins[right]) || !(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP)) |
| 23307 | 43 | ? true : strcmp(s3," ")!=0)) | |
| 23308 | { | ||
| 23309 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 388 times.
|
472 | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); |
| 23310 | 388 | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23311 | 388 | ssc_tile_hei_buf = -1; | |
| 23312 | 388 | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23313 |
1/2✓ Branch 0 taken 388 times.
✗ Branch 1 not taken.
|
388 | if(bottom_margin_clip()) break; |
| 23314 | 388 | cursor_x=msg_margins[left]; | |
| 23315 | 388 | } | |
| 23316 | |||
| 23317 | 8522 | char buf[2] = {0}; | |
| 23318 | 8522 | sprintf(buf,"%c",MsgStrings[msgstr].s[msgptr]); | |
| 23319 | |||
| 23320 | 8522 | textout_styled_aligned_ex(msg_txt_bmp_buf,msgfont,buf,cursor_x,cursor_y,msg_shdtype,sstaLEFT,msgcolour,msg_shdcol,-1); | |
| 23321 | |||
| 23322 | 8522 | cursor_x+=tlength; | |
| 23323 | 8522 | } | |
| 23324 | else | ||
| 23325 | { | ||
| 23326 | 26742 | tlength = text_length(msgfont, s3) + ((int32_t)strlen(s3)*MsgStrings[msgstr].hspace); | |
| 23327 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 356 times.
|
27266 | if(cursor_x+tlength > (msg_w-msg_margins[right]) |
| 23328 |
5/6✓ Branch 0 taken 567 times.
✓ Branch 1 taken 26175 times.
✓ Branch 2 taken 524 times.
✓ Branch 3 taken 43 times.
✓ Branch 4 taken 399 times.
✗ Branch 5 not taken.
|
26742 | && ((cursor_x > (msg_w-msg_margins[right]) || !(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP)) |
| 23329 | 168 | ? true : strcmp(s3," ")!=0)) | |
| 23330 | { | ||
| 23331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 567 times.
|
567 | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); |
| 23332 | 567 | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23333 | 567 | ssc_tile_hei_buf = -1; | |
| 23334 | 567 | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23335 |
1/2✓ Branch 0 taken 567 times.
✗ Branch 1 not taken.
|
567 | if(bottom_margin_clip()) break; |
| 23336 | 567 | cursor_x=msg_margins[left]; | |
| 23337 | 567 | } | |
| 23338 | |||
| 23339 | 26742 | sfx(MsgStrings[msgstr].sfx); | |
| 23340 | |||
| 23341 | 26742 | char buf[2] = {0}; | |
| 23342 | 26742 | sprintf(buf,"%c",MsgStrings[msgstr].s[msgptr]); | |
| 23343 | |||
| 23344 | 26742 | textout_styled_aligned_ex(msg_txt_bmp_buf,msgfont,buf,cursor_x,cursor_y,msg_shdtype,sstaLEFT,msgcolour,msg_shdcol,-1); | |
| 23345 | |||
| 23346 | 26742 | cursor_x += msgfont->vtable->char_length(msgfont, MsgStrings[msgstr].s[msgptr]); | |
| 23347 | 26742 | cursor_x += MsgStrings[msgstr].hspace; | |
| 23348 | } | ||
| 23349 | |||
| 23350 | 35264 | msgpos++; | |
| 23351 | 35264 | } | |
| 23352 |
1/2✓ Branch 0 taken 35500 times.
✗ Branch 1 not taken.
|
35500 | if(do_run_menu) |
| 23353 | { | ||
| 23354 | ✗ | if(runMenuCursor()) | |
| 23355 | { | ||
| 23356 | ✗ | do_run_menu = false; | |
| 23357 | ✗ | } | |
| 23358 | ✗ | else break; | |
| 23359 | ✗ | } | |
| 23360 |
1/2✓ Branch 0 taken 35500 times.
✗ Branch 1 not taken.
|
35500 | if(doing_name_insert) |
| 23361 | { | ||
| 23362 | ✗ | if(*nameptr) | |
| 23363 | { | ||
| 23364 | ✗ | if(bottom_margin_clip()) | |
| 23365 | ✗ | break; | |
| 23366 | |||
| 23367 | ✗ | char s3[9] = {0}; | |
| 23368 | |||
| 23369 | ✗ | if(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP) | |
| 23370 | { | ||
| 23371 | ✗ | strcpy(s3, nameptr); | |
| 23372 | ✗ | } | |
| 23373 | else | ||
| 23374 | { | ||
| 23375 | ✗ | s3[0] = *nameptr; | |
| 23376 | ✗ | s3[1] = 0; | |
| 23377 | } | ||
| 23378 | |||
| 23379 | ✗ | tlength = text_length(msgfont, s3) + ((int32_t)strlen(s3)*MsgStrings[msgstr].hspace); | |
| 23380 | |||
| 23381 | ✗ | if(cursor_x+tlength > (msg_w-msg_margins[right]) | |
| 23382 | ✗ | && ((cursor_x > (msg_w-msg_margins[right]) || !(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP)) | |
| 23383 | ✗ | ? true : strcmp(s3," ")!=0)) | |
| 23384 | { | ||
| 23385 | ✗ | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); | |
| 23386 | ✗ | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23387 | ✗ | ssc_tile_hei_buf = -1; | |
| 23388 | ✗ | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23389 | ✗ | if(bottom_margin_clip()) break; | |
| 23390 | ✗ | cursor_x=msg_margins[left]; | |
| 23391 | ✗ | } | |
| 23392 | |||
| 23393 | ✗ | sfx(MsgStrings[msgstr].sfx); | |
| 23394 | |||
| 23395 | ✗ | char buf[2] = {0}; | |
| 23396 | ✗ | sprintf(buf,"%c",*nameptr); | |
| 23397 | |||
| 23398 | ✗ | textout_styled_aligned_ex(msg_txt_bmp_buf,msgfont,buf,cursor_x,cursor_y,msg_shdtype,sstaLEFT,msgcolour,msg_shdcol,-1); | |
| 23399 | |||
| 23400 | ✗ | cursor_x += msgfont->vtable->char_length(msgfont, *nameptr); | |
| 23401 | ✗ | cursor_x += MsgStrings[msgstr].hspace; | |
| 23402 | ✗ | ++nameptr; | |
| 23403 | ✗ | continue; //don't advance the msgptr, as the next char in it was not processed! | |
| 23404 | } | ||
| 23405 | ✗ | else doing_name_insert = false; | |
| 23406 | ✗ | } | |
| 23407 | 35500 | ++msgptr; | |
| 23408 |
1/2✓ Branch 0 taken 35500 times.
✗ Branch 1 not taken.
|
35500 | if(do_end_str) |
| 23409 | ✗ | goto strendcheck; | |
| 23410 |
1/2✓ Branch 0 taken 35500 times.
✗ Branch 1 not taken.
|
35500 | if(wait_advance) |
| 23411 | ✗ | return; | |
| 23412 |
2/2✓ Branch 0 taken 34944 times.
✓ Branch 1 taken 556 times.
|
35500 | if(atend(MsgStrings[msgstr].s.c_str()+msgptr)) |
| 23413 | { | ||
| 23414 |
2/2✓ Branch 0 taken 273 times.
✓ Branch 1 taken 283 times.
|
556 | if(MsgStrings[msgstr].nextstring) |
| 23415 | { | ||
| 23416 |
1/2✓ Branch 0 taken 283 times.
✗ Branch 1 not taken.
|
283 | if(MsgStrings[MsgStrings[msgstr].nextstring].stringflags & STRINGFLAG_CONT) |
| 23417 | { | ||
| 23418 | ✗ | msgstr=MsgStrings[msgstr].nextstring; | |
| 23419 | ✗ | msgpos=msgptr=0; | |
| 23420 | ✗ | msgfont=setmsgfont(); | |
| 23421 | ✗ | } | |
| 23422 | 283 | } | |
| 23423 | 556 | } | |
| 23424 | } | ||
| 23425 | |||
| 23426 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 557 times.
|
557 | if (!do_run_menu) |
| 23427 | { | ||
| 23428 | 557 | msgclk = 72; | |
| 23429 | 557 | msgpos = 10000; | |
| 23430 | 557 | } | |
| 23431 | 557 | } | |
| 23432 | else | ||
| 23433 | 62618 | { | |
| 23434 | breakout: | ||
| 23435 | |||
| 23436 |
6/6✓ Branch 0 taken 52044 times.
✓ Branch 1 taken 10574 times.
✓ Branch 2 taken 14660 times.
✓ Branch 3 taken 37384 times.
✓ Branch 4 taken 9854 times.
✓ Branch 5 taken 4806 times.
|
62618 | if(((msgclk++)%(msgspeed+1)<msgspeed)&&((!cAbtn())||(!get_bit(quest_rules,qr_ALLOWFASTMSG)))) |
| 23437 | 42190 | return; | |
| 23438 | } | ||
| 23439 | |||
| 23440 | // Start writing the string | ||
| 23441 |
2/2✓ Branch 0 taken 20405 times.
✓ Branch 1 taken 580 times.
|
21565 | if(msgptr == 0) |
| 23442 | { | ||
| 23443 |
2/2✓ Branch 0 taken 580 times.
✓ Branch 1 taken 1101 times.
|
1681 | while(MsgStrings[msgstr].s[msgptr]==' ') |
| 23444 | { | ||
| 23445 | 1101 | tlength = msgfont->vtable->char_length(msgfont, MsgStrings[msgstr].s[msgptr]) + MsgStrings[msgstr].hspace; | |
| 23446 | |||
| 23447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
1106 | if(cursor_x+tlength > (msg_w-msg_margins[right]) |
| 23448 |
4/6✓ Branch 0 taken 1096 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
1101 | && ((cursor_x > (msg_w-msg_margins[right]) || !(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP)) |
| 23449 | ✗ | ? 1 : strcmp(s3," ")!=0)) | |
| 23450 | { | ||
| 23451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); |
| 23452 | 5 | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23453 | 5 | ssc_tile_hei_buf = -1; | |
| 23454 | 5 | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23455 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(bottom_margin_clip()) break; |
| 23456 | 5 | cursor_x=msg_margins[left]; | |
| 23457 | 5 | } | |
| 23458 | |||
| 23459 | 1101 | cursor_x+=tlength; | |
| 23460 | 1101 | ++msgptr; | |
| 23461 | 1101 | ++msgpos; | |
| 23462 | |||
| 23463 | // The "Continue From Previous" feature | ||
| 23464 |
2/2✓ Branch 0 taken 1029 times.
✓ Branch 1 taken 72 times.
|
1101 | if(atend(MsgStrings[msgstr].s.c_str()+msgptr)) |
| 23465 | { | ||
| 23466 |
1/2✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
|
72 | if(MsgStrings[msgstr].nextstring) |
| 23467 | { | ||
| 23468 | ✗ | if(MsgStrings[MsgStrings[msgstr].nextstring].stringflags & STRINGFLAG_CONT) | |
| 23469 | { | ||
| 23470 | ✗ | msgstr=MsgStrings[msgstr].nextstring; | |
| 23471 | ✗ | msgpos=msgptr=0; | |
| 23472 | ✗ | msgfont=setmsgfont(); | |
| 23473 | ✗ | } | |
| 23474 | ✗ | } | |
| 23475 | 72 | } | |
| 23476 | } | ||
| 23477 | 580 | } | |
| 23478 | |||
| 23479 | reparsesinglechar: | ||
| 23480 | // Continue printing the string! | ||
| 23481 |
3/4✓ Branch 0 taken 19822 times.
✓ Branch 1 taken 1163 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19822 times.
|
40807 | if(!atend(MsgStrings[msgstr].s.c_str()+msgptr) && !bottom_margin_clip()) |
| 23482 | { | ||
| 23483 |
4/6✓ Branch 0 taken 19822 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19822 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 94 times.
✓ Branch 5 taken 19728 times.
|
19822 | if(!do_run_menu && !doing_name_insert && !parsemsgcode()) |
| 23484 | { | ||
| 23485 | 19728 | wrapmsgstr(s3); | |
| 23486 | |||
| 23487 | 19728 | tlength = text_length(msgfont, s3) + ((int32_t)strlen(s3)*MsgStrings[msgstr].hspace); | |
| 23488 | |||
| 23489 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 234 times.
|
19982 | if(cursor_x+tlength > (msg_w-msg_margins[right]) |
| 23490 |
6/6✓ Branch 0 taken 258 times.
✓ Branch 1 taken 19470 times.
✓ Branch 2 taken 254 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 234 times.
✓ Branch 5 taken 4 times.
|
19728 | && ((cursor_x > (msg_w-msg_margins[right]) || !(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP)) |
| 23491 | 20 | ? true : strcmp(s3," ")!=0)) | |
| 23492 | { | ||
| 23493 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 254 times.
|
254 | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); |
| 23494 | 254 | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23495 | 254 | ssc_tile_hei_buf = -1; | |
| 23496 | 254 | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23497 |
1/2✓ Branch 0 taken 254 times.
✗ Branch 1 not taken.
|
254 | if(bottom_margin_clip()) goto strendcheck; |
| 23498 | 254 | cursor_x=msg_margins[left]; | |
| 23499 | //if(space) s3[0]=0; | ||
| 23500 | 254 | } | |
| 23501 | |||
| 23502 | 19728 | sfx(MsgStrings[msgstr].sfx); | |
| 23503 | |||
| 23504 | 19728 | char buf[2] = {0}; | |
| 23505 | 19728 | sprintf(buf,"%c",MsgStrings[msgstr].s[msgptr]); | |
| 23506 | |||
| 23507 | 19728 | textout_styled_aligned_ex(msg_txt_bmp_buf,msgfont,buf,cursor_x,cursor_y,msg_shdtype,sstaLEFT,msgcolour,msg_shdcol,-1); | |
| 23508 | |||
| 23509 | 19728 | cursor_x += msgfont->vtable->char_length(msgfont, MsgStrings[msgstr].s[msgptr]); | |
| 23510 | 19728 | cursor_x += MsgStrings[msgstr].hspace; | |
| 23511 | 19728 | msgpos++; | |
| 23512 | 19728 | } | |
| 23513 |
1/2✓ Branch 0 taken 19822 times.
✗ Branch 1 not taken.
|
19822 | if(do_end_str) |
| 23514 | ✗ | goto strendcheck; | |
| 23515 |
1/2✓ Branch 0 taken 19822 times.
✗ Branch 1 not taken.
|
19822 | if(wait_advance) |
| 23516 | { | ||
| 23517 | ✗ | ++msgptr; | |
| 23518 | ✗ | return; | |
| 23519 | } | ||
| 23520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19822 times.
|
19822 | else if(do_run_menu) |
| 23521 | { | ||
| 23522 | ✗ | if(runMenuCursor()) | |
| 23523 | { | ||
| 23524 | ✗ | do_run_menu = false; | |
| 23525 | ✗ | ++msgptr; | |
| 23526 | ✗ | goto reparsesinglechar; | |
| 23527 | } | ||
| 23528 | ✗ | } | |
| 23529 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19822 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19822 | else if(doing_name_insert && *nameptr) |
| 23530 | { | ||
| 23531 | ✗ | char s3[9] = {0}; | |
| 23532 | |||
| 23533 | ✗ | if(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP) | |
| 23534 | { | ||
| 23535 | ✗ | strcpy(s3, nameptr); | |
| 23536 | ✗ | } | |
| 23537 | else | ||
| 23538 | { | ||
| 23539 | ✗ | s3[0] = *nameptr; | |
| 23540 | ✗ | s3[1] = 0; | |
| 23541 | } | ||
| 23542 | |||
| 23543 | ✗ | tlength = text_length(msgfont, s3) + ((int32_t)strlen(s3)*MsgStrings[msgstr].hspace); | |
| 23544 | |||
| 23545 | ✗ | if(cursor_x+tlength > (msg_w-msg_margins[right]) | |
| 23546 | ✗ | && ((cursor_x > (msg_w-msg_margins[right]) || !(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP)) | |
| 23547 | ✗ | ? true : strcmp(s3," ")!=0)) | |
| 23548 | { | ||
| 23549 | ✗ | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); | |
| 23550 | ✗ | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23551 | ✗ | ssc_tile_hei_buf = -1; | |
| 23552 | ✗ | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23553 | ✗ | if(bottom_margin_clip()) goto strendcheck; | |
| 23554 | ✗ | cursor_x=msg_margins[left]; | |
| 23555 | ✗ | } | |
| 23556 | |||
| 23557 | ✗ | sfx(MsgStrings[msgstr].sfx); | |
| 23558 | |||
| 23559 | ✗ | char buf[2] = {0}; | |
| 23560 | ✗ | sprintf(buf,"%c",*nameptr); | |
| 23561 | |||
| 23562 | ✗ | textout_styled_aligned_ex(msg_txt_bmp_buf,msgfont,buf,cursor_x,cursor_y,msg_shdtype,sstaLEFT,msgcolour,msg_shdcol,-1); | |
| 23563 | |||
| 23564 | ✗ | cursor_x += msgfont->vtable->char_length(msgfont, *nameptr); | |
| 23565 | ✗ | cursor_x += MsgStrings[msgstr].hspace; | |
| 23566 | ✗ | ++nameptr; | |
| 23567 | ✗ | } | |
| 23568 | else | ||
| 23569 | { | ||
| 23570 | 19822 | doing_name_insert = false; | |
| 23571 | 19822 | msgptr++; | |
| 23572 | |||
| 23573 |
2/2✓ Branch 0 taken 19330 times.
✓ Branch 1 taken 492 times.
|
19822 | if(atend(MsgStrings[msgstr].s.c_str()+msgptr)) |
| 23574 | { | ||
| 23575 |
2/2✓ Branch 0 taken 433 times.
✓ Branch 1 taken 59 times.
|
492 | if(MsgStrings[msgstr].nextstring) |
| 23576 | { | ||
| 23577 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(MsgStrings[MsgStrings[msgstr].nextstring].stringflags & STRINGFLAG_CONT) |
| 23578 | { | ||
| 23579 | ✗ | msgstr=MsgStrings[msgstr].nextstring; | |
| 23580 | ✗ | msgpos=msgptr=0; | |
| 23581 | ✗ | msgfont=setmsgfont(); | |
| 23582 | ✗ | } | |
| 23583 | 59 | } | |
| 23584 | 492 | } | |
| 23585 | |||
| 23586 |
2/2✓ Branch 0 taken 2932 times.
✓ Branch 1 taken 978 times.
|
23732 | if(MsgStrings[msgstr].s.size() > unsigned(msgptr+1) |
| 23587 |
2/2✓ Branch 0 taken 19775 times.
✓ Branch 1 taken 47 times.
|
19822 | && (MsgStrings[msgstr].s[msgptr]==' ') |
| 23588 |
2/2✓ Branch 0 taken 3910 times.
✓ Branch 1 taken 15865 times.
|
19775 | && (MsgStrings[msgstr].s[msgptr+1]==' ')) |
| 23589 | { | ||
| 23590 |
2/2✓ Branch 0 taken 978 times.
✓ Branch 1 taken 32295 times.
|
33273 | while(MsgStrings[msgstr].s[msgptr]==' ') |
| 23591 | { | ||
| 23592 | 32295 | msgspace = true; | |
| 23593 | 32295 | tlength = msgfont->vtable->char_length(msgfont, MsgStrings[msgstr].s[msgptr]) + MsgStrings[msgstr].hspace; | |
| 23594 | |||
| 23595 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1409 times.
|
33727 | if(cursor_x+tlength > (msg_w-msg_margins[right]) |
| 23596 |
4/6✓ Branch 0 taken 1432 times.
✓ Branch 1 taken 30863 times.
✓ Branch 2 taken 1432 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1409 times.
✗ Branch 5 not taken.
|
32295 | && ((cursor_x > (msg_w-msg_margins[right]) || !(MsgStrings[msgstr].stringflags & STRINGFLAG_WRAP)) |
| 23597 | 23 | ? true : strcmp(s3," ")!=0)) | |
| 23598 | { | ||
| 23599 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1432 times.
|
1432 | int32_t thei = zc_max(ssc_tile_hei, text_height(msgfont)); |
| 23600 | 1432 | ssc_tile_hei = ssc_tile_hei_buf; | |
| 23601 | 1432 | ssc_tile_hei_buf = -1; | |
| 23602 | 1432 | cursor_y += thei + MsgStrings[msgstr].vspace; | |
| 23603 |
1/2✓ Branch 0 taken 1432 times.
✗ Branch 1 not taken.
|
1432 | if(bottom_margin_clip()) break; |
| 23604 | 1432 | cursor_x=msg_margins[left]; | |
| 23605 | 1432 | } | |
| 23606 | |||
| 23607 | 32295 | cursor_x+=tlength; | |
| 23608 | 32295 | ++msgpos; | |
| 23609 | 32295 | ++msgptr; | |
| 23610 | |||
| 23611 |
2/2✓ Branch 0 taken 2713 times.
✓ Branch 1 taken 29582 times.
|
32295 | if(atend(MsgStrings[msgstr].s.c_str()+msgptr)) |
| 23612 | { | ||
| 23613 |
2/2✓ Branch 0 taken 25531 times.
✓ Branch 1 taken 4051 times.
|
29582 | if(MsgStrings[msgstr].nextstring) |
| 23614 | { | ||
| 23615 |
1/2✓ Branch 0 taken 4051 times.
✗ Branch 1 not taken.
|
4051 | if(MsgStrings[MsgStrings[msgstr].nextstring].stringflags & STRINGFLAG_CONT) |
| 23616 | { | ||
| 23617 | ✗ | msgstr=MsgStrings[msgstr].nextstring; | |
| 23618 | ✗ | msgpos=msgptr=0; | |
| 23619 | ✗ | msgfont=setmsgfont(); | |
| 23620 | ✗ | } | |
| 23621 | 4051 | } | |
| 23622 | 29582 | } | |
| 23623 | } | ||
| 23624 | 978 | } | |
| 23625 | } | ||
| 23626 | 19822 | } | |
| 23627 | strendcheck: | ||
| 23628 | // Done printing the string | ||
| 23629 |
10/14✓ Branch 0 taken 20985 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20985 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20985 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 20428 times.
✓ Branch 7 taken 557 times.
✓ Branch 8 taken 19949 times.
✓ Branch 9 taken 479 times.
✓ Branch 10 taken 19949 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 19554 times.
✓ Branch 13 taken 1431 times.
|
20985 | if(do_end_str || !doing_name_insert && !do_run_menu && (msgpos>=10000 || msgptr>=MsgStrings[msgstr].s.size() || bottom_margin_clip() || atend(MsgStrings[msgstr].s.c_str()+msgptr)) && !linkedmsgclk) |
| 23630 | { | ||
| 23631 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1431 times.
|
1431 | if(!do_end_str) |
| 23632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1431 times.
|
1431 | while(parsemsgcode()); // Finish remaining control codes |
| 23633 | |||
| 23634 | // Go to next string, or make it disappear by going to string 0. | ||
| 23635 |
5/6✓ Branch 0 taken 1089 times.
✓ Branch 1 taken 342 times.
✓ Branch 2 taken 921 times.
✓ Branch 3 taken 168 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 921 times.
|
1431 | if(MsgStrings[msgstr].nextstring!=0 || get_bit(quest_rules,qr_MSGDISAPPEAR) || enqueued_str) |
| 23636 | { | ||
| 23637 | 510 | linkedmsgclk=do_end_str?1:51; | |
| 23638 | 510 | } | |
| 23639 | |||
| 23640 |
2/2✓ Branch 0 taken 1089 times.
✓ Branch 1 taken 342 times.
|
1431 | if(MsgStrings[msgstr].nextstring==0) |
| 23641 | { | ||
| 23642 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 921 times.
|
1089 | if(!get_bit(quest_rules,qr_MSGDISAPPEAR)) |
| 23643 | 921 | { | |
| 23644 | disappear: | ||
| 23645 | 1089 | msg_active = false; | |
| 23646 | 1089 | Hero.finishedmsg(); | |
| 23647 | 1089 | } | |
| 23648 | |||
| 23649 |
2/2✓ Branch 0 taken 1245 times.
✓ Branch 1 taken 12 times.
|
1257 | if(repaircharge) |
| 23650 | { | ||
| 23651 | // if (get_bit(quest_rules,qr_REPAIRFIX)) { | ||
| 23652 | // fixed_door=true; | ||
| 23653 | // } | ||
| 23654 | 12 | game->change_drupy(-tmpscr[currscr<128?0:1].catchall); | |
| 23655 | 12 | repaircharge = 0; | |
| 23656 | 12 | } | |
| 23657 | |||
| 23658 |
2/2✓ Branch 0 taken 1256 times.
✓ Branch 1 taken 1 times.
|
1257 | if(adjustmagic) |
| 23659 | { | ||
| 23660 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(get_bit(quest_rules,qr_OLD_HALF_MAGIC)) |
| 23661 | { | ||
| 23662 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(game->get_magicdrainrate()) |
| 23663 | 1 | game->set_magicdrainrate(1); | |
| 23664 | 1 | } | |
| 23665 | ✗ | else if(game->get_magicdrainrate() > 1) | |
| 23666 | { | ||
| 23667 | ✗ | game->set_magicdrainrate(game->get_magicdrainrate()/2); | |
| 23668 | ✗ | } | |
| 23669 | 1 | adjustmagic = false; | |
| 23670 | 1 | sfx(WAV_SCALE); | |
| 23671 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | setmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 23672 | 1 | } | |
| 23673 | |||
| 23674 |
2/2✓ Branch 0 taken 1256 times.
✓ Branch 1 taken 1 times.
|
1257 | if(learnslash) |
| 23675 | { | ||
| 23676 | 1 | game->set_canslash(1); | |
| 23677 | 1 | learnslash = false; | |
| 23678 | 1 | sfx(WAV_SCALE); | |
| 23679 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | setmapflag((currscr < 128 && get_bit(quest_rules, qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 23680 | 1 | } | |
| 23681 | 1257 | } | |
| 23682 | 1599 | } | |
| 23683 | 6439146 | } | |
| 23684 | |||
| 23685 | 14090 | int32_t message_more_y() | |
| 23686 | { | ||
| 23687 | //Is the flag ticked, do we really want a message more y larger than 160? | ||
| 23688 |
5/6✓ Branch 0 taken 14 times.
✓ Branch 1 taken 14076 times.
✓ Branch 2 taken 14090 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14076 times.
✓ Branch 5 taken 14 times.
|
14090 | int32_t msgy=zc_min((zinit.msg_more_is_offset==0)?zinit.msg_more_y:zinit.msg_more_y+MsgStrings[msgstr].y ,160); |
| 23689 | 14090 | msgy+=playing_field_offset; | |
| 23690 | 14090 | return msgy; | |
| 23691 | } | ||
| 23692 | |||
| 23693 | /*** Collision detection & handling ***/ | ||
| 23694 | |||
| 23695 | 6417004 | void clear_script_one_frame_conditions() | |
| 23696 | { | ||
| 23697 |
2/2✓ Branch 0 taken 19758384 times.
✓ Branch 1 taken 6417004 times.
|
26175388 | for(int32_t j=0; j<guys.Count(); j++) |
| 23698 | { | ||
| 23699 | 19758384 | enemy *e = (enemy*)guys.spr(j); | |
| 23700 |
2/2✓ Branch 0 taken 316134144 times.
✓ Branch 1 taken 19758384 times.
|
335892528 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) e->hitby[q] = 0; |
| 23701 | 19758384 | } | |
| 23702 | 6417004 | } | |
| 23703 | |||
| 23704 | 6416893 | void check_collisions() | |
| 23705 | { | ||
| 23706 |
2/2✓ Branch 0 taken 2621925 times.
✓ Branch 1 taken 6416893 times.
|
9038818 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 23707 | { | ||
| 23708 | 2621925 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 23709 | |||
| 23710 |
8/8✓ Branch 0 taken 2277423 times.
✓ Branch 1 taken 344502 times.
✓ Branch 2 taken 1907203 times.
✓ Branch 3 taken 370220 times.
✓ Branch 4 taken 1885890 times.
✓ Branch 5 taken 21313 times.
✓ Branch 6 taken 13640 times.
✓ Branch 7 taken 1872250 times.
|
2621925 | if(!(w->Dead()) && w->id!=wSword && w->id!=wHammer && w->id!=wWand) |
| 23711 | { | ||
| 23712 |
2/2✓ Branch 0 taken 1862126 times.
✓ Branch 1 taken 6645771 times.
|
8507897 | for(int32_t j=0; j<guys.Count(); j++) |
| 23713 | { | ||
| 23714 | 6645771 | enemy *e = (enemy*)guys.spr(j); | |
| 23715 | |||
| 23716 |
2/2✓ Branch 0 taken 6519036 times.
✓ Branch 1 taken 126735 times.
|
6645771 | if(e->hit(w)) //boomerangs and such that last for more than a frame can write hitby[] for more than one frame, |
| 23717 | //because this only checks `if(dying || clk<0 || hclk>0 || superman)` | ||
| 23718 | { | ||
| 23719 | // !(e->stunclk) | ||
| 23720 | 126735 | int32_t h = e->takehit(w); | |
| 23721 |
2/2✓ Branch 0 taken 105867 times.
✓ Branch 1 taken 20868 times.
|
126735 | if (h == -1) |
| 23722 | { | ||
| 23723 | 20868 | e->hitby[HIT_BY_LWEAPON] = i+1; | |
| 23724 | 20868 | e->hitby[HIT_BY_LWEAPON_UID] = w->script_UID; | |
| 23725 | //e->hitby[HIT_BY_LWEAPON_FAMILY] = itemsbuf[w->parentid].family; //that would be the itemclass, not the weapon type! | ||
| 23726 | 20868 | e->hitby[HIT_BY_LWEAPON_FAMILY] = w->id; | |
| 23727 | //al_trace("npc->HitBy[] Parent Item is: %d /n", w->parentitem); | ||
| 23728 | //al_trace("npc->HitBy[] Parent ID is: %d /n", w->parentid); | ||
| 23729 | 20868 | e->hitby[HIT_BY_LWEAPON_LITERAL_ID] = w->parentitem; | |
| 23730 | |||
| 23731 | 20868 | } | |
| 23732 | //we may need to handle this in special cases. -Z | ||
| 23733 | |||
| 23734 | //if h == stun or ignore | ||
| 23735 | |||
| 23736 | //if e->stun > DEFAULT_STUN -1 || !e->stun | ||
| 23737 | //if the enemy wasn't stunned this round -- what a bitch, as the stun value is set before we check this | ||
| 23738 | ///! how about: if w->dead != bounce ! | ||
| 23739 | |||
| 23740 | // NOT FOR PUBLIC RELEASE | ||
| 23741 | /*if(h==3) //Mirror shield | ||
| 23742 | { | ||
| 23743 | if (w->id==ewFireball || w->id==wRefFireball) | ||
| 23744 | { | ||
| 23745 | w->id=wRefFireball; | ||
| 23746 | switch(e->dir) | ||
| 23747 | { | ||
| 23748 | case up: e->angle += (PI - e->angle) * 2.0; break; | ||
| 23749 | case down: e->angle = -e->angle; break; | ||
| 23750 | case left: e->angle += ((-PI/2) - e->angle) * 2.0; break; | ||
| 23751 | case right: e->angle += (( PI/2) - e->angle) * 2.0; break; | ||
| 23752 | // TODO: the following. -L. | ||
| 23753 | case l_up: break; | ||
| 23754 | case r_up: break; | ||
| 23755 | case l_down: break; | ||
| 23756 | case r_down: break; | ||
| 23757 | } | ||
| 23758 | } | ||
| 23759 | else | ||
| 23760 | { | ||
| 23761 | w->id = ((w->id==ewMagic || w->id==wRefMagic || w->id==wMagic) ? wRefMagic : wRefBeam); | ||
| 23762 | w->dir ^= 1; | ||
| 23763 | if(w->dir&2) | ||
| 23764 | w->flip ^= 1; | ||
| 23765 | else | ||
| 23766 | w->flip ^= 2; | ||
| 23767 | } | ||
| 23768 | w->ignoreHero=false; | ||
| 23769 | } | ||
| 23770 | else*/ | ||
| 23771 |
2/2✓ Branch 0 taken 98954 times.
✓ Branch 1 taken 27781 times.
|
126735 | if(h) |
| 23772 | { | ||
| 23773 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 27781 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
27781 | if(e->switch_hooked && w->family_class == itype_switchhook) |
| 23774 | ✗ | w->onhit(false, e, -1); | |
| 23775 | 27781 | else w->onhit(false, e, h); | |
| 23776 | 27781 | } | |
| 23777 | |||
| 23778 |
2/2✓ Branch 0 taken 124426 times.
✓ Branch 1 taken 2309 times.
|
126735 | if(h==2) |
| 23779 | { | ||
| 23780 | 2309 | break; | |
| 23781 | } | ||
| 23782 | 124426 | } | |
| 23783 | |||
| 23784 |
2/2✓ Branch 0 taken 6635647 times.
✓ Branch 1 taken 7815 times.
|
6643462 | if(w->Dead()) |
| 23785 | { | ||
| 23786 | 7815 | break; | |
| 23787 | } | ||
| 23788 | 6635647 | } | |
| 23789 | |||
| 23790 | // Item flags added in 2.55: | ||
| 23791 | // BRang/HShot/Arrows ITEM_FLAG4 is "Pick up anything" (port of qr_BRANGPICKUP) | ||
| 23792 | // BRang/HShot ITEM_FLAG5 is "Drags Items" (port of qr_Z3BRANG_HSHOT) | ||
| 23793 | // Arrows ITEM_FLAG2 is "Picks up items" (inverse port of qr_Z3BRANG_HSHOT) | ||
| 23794 | // -V | ||
| 23795 |
6/6✓ Branch 0 taken 1585331 times.
✓ Branch 1 taken 286919 times.
✓ Branch 2 taken 1580855 times.
✓ Branch 3 taken 4476 times.
✓ Branch 4 taken 18036 times.
✓ Branch 5 taken 1562819 times.
|
1872250 | if(w->id == wBrang || w->id == wHookshot || w->id == wArrow) |
| 23796 | { | ||
| 23797 | 309431 | int32_t itype, pitem = w->parentitem; | |
| 23798 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 286919 times.
✓ Branch 2 taken 18036 times.
✓ Branch 3 taken 4476 times.
|
309431 | switch(w->id) |
| 23799 | { | ||
| 23800 | 286919 | case wBrang: itype = itype_brang; break; | |
| 23801 | 18036 | case wArrow: itype = itype_arrow; break; | |
| 23802 | case wHookshot: | ||
| 23803 | 4476 | itype = (w->family_class == itype_switchhook ? itype_switchhook :itype_hookshot); | |
| 23804 | 4476 | break; | |
| 23805 | } | ||
| 23806 |
2/2✓ Branch 0 taken 306588 times.
✓ Branch 1 taken 2843 times.
|
309431 | if(pitem < 0) pitem = current_item_id(itype); |
| 23807 |
5/6✓ Branch 0 taken 4476 times.
✓ Branch 1 taken 304955 times.
✓ Branch 2 taken 100 times.
✓ Branch 3 taken 4376 times.
✓ Branch 4 taken 100 times.
✗ Branch 5 not taken.
|
309431 | if(w->id == wHookshot && w->family_class == itype_switchhook && (itemsbuf[pitem].flags & ITEM_FLAG9)) |
| 23808 | { //Swap with item | ||
| 23809 | ✗ | for(int32_t j=0; j<items.Count(); j++) | |
| 23810 | { | ||
| 23811 | ✗ | if(items.spr(j)->hit(w)) | |
| 23812 | { | ||
| 23813 | ✗ | item *theItem = ((item*)items.spr(j)); | |
| 23814 | ✗ | bool priced = theItem->PriceIndex >-1; | |
| 23815 | ✗ | bool isKey = itemsbuf[theItem->id].family==itype_key||itemsbuf[theItem->id].family==itype_lkey; | |
| 23816 | ✗ | if(!theItem->fallclk && !theItem->drownclk && ((theItem->pickup & ipTIMER && theItem->clk2 >= 32) | |
| 23817 | ✗ | || (((itemsbuf[w->parentitem].flags & ITEM_FLAG4)||(theItem->pickup & ipCANGRAB)||((itemsbuf[w->parentitem].flags & ITEM_FLAG7)&&isKey)) && !priced && !(theItem->pickup & ipDUMMY)))) | |
| 23818 | { | ||
| 23819 | ✗ | if(!Hero.switchhookclk) | |
| 23820 | { | ||
| 23821 | ✗ | hooked_combopos = -1; | |
| 23822 | ✗ | hooked_layerbits = 0; | |
| 23823 | ✗ | switching_object = theItem; | |
| 23824 | ✗ | theItem->switch_hooked = true; | |
| 23825 | ✗ | w->misc = 2; | |
| 23826 | ✗ | w->step = 0; | |
| 23827 | ✗ | theItem->clk2=256; | |
| 23828 | ✗ | Hero.doSwitchHook(game->get_switchhookstyle()); | |
| 23829 | ✗ | if(QMisc.miscsfx[sfxSWITCHED]) | |
| 23830 | ✗ | sfx(QMisc.miscsfx[sfxSWITCHED],int32_t(w->x)); | |
| 23831 | ✗ | } | |
| 23832 | ✗ | } | |
| 23833 | ✗ | } | |
| 23834 | ✗ | } | |
| 23835 | ✗ | } | |
| 23836 |
6/6✓ Branch 0 taken 18036 times.
✓ Branch 1 taken 291395 times.
✓ Branch 2 taken 290599 times.
✓ Branch 3 taken 272563 times.
✓ Branch 4 taken 291395 times.
✓ Branch 5 taken 272563 times.
|
309431 | else if((w->id==wArrow&&itemsbuf[pitem].flags & ITEM_FLAG2)||(w->id!=wArrow&&!(itemsbuf[pitem].flags & ITEM_FLAG5)))//An arrow with "Picks up items" or a BRang/HShot without "Drags items" |
| 23837 | { | ||
| 23838 |
2/2✓ Branch 0 taken 68557 times.
✓ Branch 1 taken 290599 times.
|
359156 | for(int32_t j=0; j<items.Count(); j++) |
| 23839 | { | ||
| 23840 |
2/2✓ Branch 0 taken 64558 times.
✓ Branch 1 taken 3999 times.
|
68557 | if(items.spr(j)->hit(w)) |
| 23841 | { | ||
| 23842 | 3999 | item *theItem = ((item*)items.spr(j)); | |
| 23843 | 3999 | bool priced = theItem->PriceIndex >-1; | |
| 23844 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 3915 times.
|
3999 | bool isKey = itemsbuf[theItem->id].family==itype_key||itemsbuf[theItem->id].family==itype_lkey; |
| 23845 |
5/8✓ Branch 0 taken 3999 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3999 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3203 times.
✓ Branch 5 taken 796 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1764 times.
|
5763 | if(!theItem->fallclk && !theItem->drownclk && ((theItem->pickup & ipTIMER && theItem->clk2 >= 32) |
| 23846 |
4/6✓ Branch 0 taken 2560 times.
✓ Branch 1 taken 1764 times.
✓ Branch 2 taken 2560 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2560 times.
|
3999 | || (((itemsbuf[pitem].flags & ITEM_FLAG4)||(theItem->pickup & ipCANGRAB)||((itemsbuf[pitem].flags & ITEM_FLAG7)&&isKey))&& !priced))) |
| 23847 | { | ||
| 23848 |
1/2✓ Branch 0 taken 1439 times.
✗ Branch 1 not taken.
|
4967 | if(itemsbuf[theItem->id].collect_script) |
| 23849 | { | ||
| 23850 | ✗ | ZScriptVersion::RunScript(SCRIPT_ITEM, itemsbuf[theItem->id].collect_script, theItem->id & 0xFFF); | |
| 23851 | ✗ | } | |
| 23852 | |||
| 23853 | 1439 | Hero.checkitems(j); | |
| 23854 | 1439 | } | |
| 23855 | 3999 | } | |
| 23856 | 68557 | } | |
| 23857 | 290599 | } | |
| 23858 |
2/2✓ Branch 0 taken 2866 times.
✓ Branch 1 taken 15966 times.
|
563958 | else if(w->id!=wArrow) //A BRang/HShot with "Drags Items" |
| 23859 | { | ||
| 23860 |
2/2✓ Branch 0 taken 3334 times.
✓ Branch 1 taken 15966 times.
|
19300 | for(int32_t j=0; j<items.Count(); j++) |
| 23861 | { | ||
| 23862 |
2/2✓ Branch 0 taken 2399 times.
✓ Branch 1 taken 935 times.
|
3334 | if(items.spr(j)->hit(w)) |
| 23863 | { | ||
| 23864 | 935 | item *theItem = ((item*)items.spr(j)); | |
| 23865 | 935 | bool priced = theItem->PriceIndex >-1; | |
| 23866 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 935 times.
|
935 | bool isKey = itemsbuf[theItem->id].family==itype_key||itemsbuf[theItem->id].family==itype_lkey; |
| 23867 |
4/6✓ Branch 0 taken 935 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 935 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 895 times.
✓ Branch 5 taken 40 times.
|
935 | if(!theItem->fallclk && !theItem->drownclk && ((theItem->pickup & ipTIMER && theItem->clk2 >= 32) |
| 23868 |
5/10✓ Branch 0 taken 559 times.
✓ Branch 1 taken 336 times.
✓ Branch 2 taken 376 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 376 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 376 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
935 | || (((itemsbuf[pitem].flags & ITEM_FLAG4)||(theItem->pickup & ipCANGRAB)||((itemsbuf[pitem].flags & ITEM_FLAG7)&&isKey)) && !priced && !(theItem->pickup & ipDUMMY)))) |
| 23869 | { | ||
| 23870 | 559 | int32_t pickup = theItem->pickup; | |
| 23871 | 559 | int32_t id2 = theItem->id; | |
| 23872 | 559 | int32_t pstr = theItem->pstring; | |
| 23873 | 559 | int32_t pstr_flags = theItem->pickup_string_flags; | |
| 23874 | |||
| 23875 | 559 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 23876 | 559 | ev.clear(); | |
| 23877 | 559 | ev.push_back(id2*10000); | |
| 23878 | 559 | ev.push_back(pickup*10000); | |
| 23879 | 559 | ev.push_back(pstr*10000); | |
| 23880 | 559 | ev.push_back(pstr_flags*10000); | |
| 23881 | 559 | ev.push_back(0); | |
| 23882 | 559 | ev.push_back(theItem->getUID()); | |
| 23883 | 559 | ev.push_back(GENEVT_ICTYPE_RANGED_DRAG*10000); | |
| 23884 | 559 | ev.push_back(w->getUID()); | |
| 23885 | |||
| 23886 | 559 | throwGenScriptEvent(GENSCR_EVENT_COLLECT_ITEM); | |
| 23887 | 559 | bool nullify = ev[4] != 0; | |
| 23888 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
|
559 | if(nullify) continue; |
| 23889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 559 times.
|
559 | if(w->id == wBrang) |
| 23890 | { | ||
| 23891 | 559 | w->onhit(false); | |
| 23892 | 559 | } | |
| 23893 | |||
| 23894 |
2/2✓ Branch 0 taken 522 times.
✓ Branch 1 taken 37 times.
|
559 | if(w->dragging==-1) |
| 23895 | { | ||
| 23896 | 37 | w->dead=1; | |
| 23897 | 37 | theItem->clk2=256; | |
| 23898 | 37 | w->dragging=j; | |
| 23899 | 37 | theItem->is_dragged = true; | |
| 23900 | 37 | } | |
| 23901 | 559 | } | |
| 23902 | 935 | } | |
| 23903 | 3334 | } | |
| 23904 | 15966 | } | |
| 23905 | 309431 | } | |
| 23906 | 1872250 | } | |
| 23907 | 2621925 | } | |
| 23908 | 6416893 | } | |
| 23909 | |||
| 23910 | 6417004 | void dragging_item() | |
| 23911 | { | ||
| 23912 |
2/2✓ Branch 0 taken 2668377 times.
✓ Branch 1 taken 6417004 times.
|
9085381 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 23913 | { | ||
| 23914 | 2668377 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 23915 | |||
| 23916 |
4/4✓ Branch 0 taken 2375354 times.
✓ Branch 1 taken 293023 times.
✓ Branch 2 taken 2652070 times.
✓ Branch 3 taken 16307 times.
|
2668377 | if((w->id == wBrang || w->id==wHookshot)&&itemsbuf[w->parentitem].flags & ITEM_FLAG5)//ITEM_FLAG5 is a port for qr_Z3BRANG_HSHOT |
| 23917 | { | ||
| 23918 |
3/4✓ Branch 0 taken 551 times.
✓ Branch 1 taken 15756 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 551 times.
|
16307 | if(w->dragging>=0 && w->dragging<items.Count()) |
| 23919 | { | ||
| 23920 | 551 | item* dragItem = (item*)items.spr(w->dragging); | |
| 23921 | 551 | dragItem->x=w->x; | |
| 23922 | 551 | dragItem->y=w->y; | |
| 23923 | |||
| 23924 | // Drag the Fairy enemy as well as the Fairy item | ||
| 23925 | 551 | int32_t id = dragItem->id; | |
| 23926 | |||
| 23927 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 551 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
551 | if(itemsbuf[id].family ==itype_fairy && itemsbuf[id].misc3) |
| 23928 | { | ||
| 23929 | ✗ | movefairynew2(w->x,w->y,*dragItem); | |
| 23930 | ✗ | } | |
| 23931 | 551 | } | |
| 23932 | 16307 | } | |
| 23933 | 2668377 | } | |
| 23934 | 6417004 | } | |
| 23935 | |||
| 23936 | 27 | int32_t more_carried_items() | |
| 23937 | { | ||
| 23938 | 27 | int32_t hasmorecarries = 0; | |
| 23939 | |||
| 23940 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 27 times.
|
57 | for(int32_t i=0; i<items.Count(); i++) |
| 23941 | { | ||
| 23942 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 27 times.
|
30 | if(((item*)items.spr(i))->pickup & ipENEMY) |
| 23943 | { | ||
| 23944 | 27 | hasmorecarries++; | |
| 23945 | 27 | } | |
| 23946 | 30 | } | |
| 23947 | |||
| 23948 | 27 | return hasmorecarries; | |
| 23949 | } | ||
| 23950 | |||
| 23951 | // messy code to do the enemy-carrying-the-item thing | ||
| 23952 | 6417004 | void roaming_item() | |
| 23953 | { | ||
| 23954 |
4/4✓ Branch 0 taken 12060 times.
✓ Branch 1 taken 6404944 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 12029 times.
|
6417004 | if(!(hasitem&(4|2)) || !loaded_enemies) |
| 23955 | 6404975 | return; | |
| 23956 | |||
| 23957 | // All enemies already dead upon entering a room? | ||
| 23958 |
1/2✓ Branch 0 taken 12029 times.
✗ Branch 1 not taken.
|
12029 | if(guys.Count()==0) |
| 23959 | { | ||
| 23960 | ✗ | return; | |
| 23961 | } | ||
| 23962 | |||
| 23963 | // Lost track of the carrier? | ||
| 23964 |
5/6✓ Branch 0 taken 12029 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12028 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 12021 times.
✓ Branch 5 taken 7 times.
|
12029 | if(guycarryingitem<0 || guycarryingitem>=guys.Count() || |
| 23965 | 12028 | !((enemy*)guys.spr(guycarryingitem))->itemguy) | |
| 23966 | { | ||
| 23967 | 8 | guycarryingitem=-1; | |
| 23968 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | for(int32_t j=0; j<guys.Count(); j++) |
| 23969 | { | ||
| 23970 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 8 times.
|
30 | if(((enemy*)guys.spr(j))->itemguy) |
| 23971 | { | ||
| 23972 | 8 | guycarryingitem=j; | |
| 23973 | 8 | break; | |
| 23974 | } | ||
| 23975 | 22 | } | |
| 23976 | 8 | } | |
| 23977 | |||
| 23978 |
2/2✓ Branch 0 taken 12000 times.
✓ Branch 1 taken 29 times.
|
12029 | if(hasitem&4) |
| 23979 | { | ||
| 23980 | 29 | guycarryingitem = -1; | |
| 23981 | |||
| 23982 |
2/2✓ Branch 0 taken 219 times.
✓ Branch 1 taken 29 times.
|
248 | for(int32_t i=0; i<guys.Count(); i++) |
| 23983 | { | ||
| 23984 |
2/2✓ Branch 0 taken 190 times.
✓ Branch 1 taken 29 times.
|
219 | if(((enemy*)guys.spr(i))->itemguy) |
| 23985 | { | ||
| 23986 | 29 | guycarryingitem = i; | |
| 23987 | 29 | } | |
| 23988 | 219 | } | |
| 23989 | |||
| 23990 |
1/2✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
|
29 | if(guycarryingitem == -1) //This happens when "default enemies" such as |
| 23991 | { | ||
| 23992 | ✗ | return; //eSHOOTFBALL are alive but enemies from the list | |
| 23993 | } //are not. Defer to HeroClass::checkspecial(). | ||
| 23994 | |||
| 23995 | 29 | int32_t Item=tmpscr->item; | |
| 23996 | |||
| 23997 | 29 | hasitem &= ~4; | |
| 23998 | |||
| 23999 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29 times.
|
29 | if((!getmapflag(mITEM) || (tmpscr->flags9&fITEMRETURN)) && (tmpscr->hasitem != 0)) |
| 24000 | { | ||
| 24001 | 55 | additem(0,0,Item,ipENEMY+ipONETIME+ipBIGRANGE | |
| 24002 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 26 times.
|
29 | + (((tmpscr->flags3&fHOLDITEM) || (itemsbuf[Item].family==itype_triforcepiece)) ? ipHOLDUP : 0) |
| 24003 | ); | ||
| 24004 | 29 | hasitem |= 2; | |
| 24005 | 29 | } | |
| 24006 | else | ||
| 24007 | { | ||
| 24008 | ✗ | return; | |
| 24009 | } | ||
| 24010 | 29 | } | |
| 24011 | |||
| 24012 |
2/2✓ Branch 0 taken 12784 times.
✓ Branch 1 taken 12029 times.
|
24813 | for(int32_t i=0; i<items.Count(); i++) |
| 24013 | { | ||
| 24014 |
2/2✓ Branch 0 taken 755 times.
✓ Branch 1 taken 12029 times.
|
12784 | if(((item*)items.spr(i))->pickup&ipENEMY) |
| 24015 | { | ||
| 24016 |
2/2✓ Branch 0 taken 4808 times.
✓ Branch 1 taken 7221 times.
|
12029 | if(get_bit(quest_rules,qr_HIDECARRIEDITEMS)) |
| 24017 | { | ||
| 24018 | 7221 | items.spr(i)->x = -128; // Awfully inelegant, innit? | |
| 24019 | 7221 | items.spr(i)->y = -128; | |
| 24020 | 7221 | } | |
| 24021 |
2/4✓ Branch 0 taken 4808 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4808 times.
|
4808 | else if(guycarryingitem>=0 && guycarryingitem<guys.Count()) |
| 24022 | { | ||
| 24023 |
1/2✓ Branch 0 taken 4808 times.
✗ Branch 1 not taken.
|
4808 | if (!get_bit(quest_rules, qr_BROKEN_ITEM_CARRYING)) |
| 24024 | { | ||
| 24025 | ✗ | if (get_bit(quest_rules, qr_ENEMY_DROPS_USE_HITOFFSETS)) | |
| 24026 | { | ||
| 24027 | ✗ | items.spr(i)->x = guys.spr(guycarryingitem)->x+guys.spr(guycarryingitem)->hxofs+(guys.spr(guycarryingitem)->hxsz/2)-8; | |
| 24028 | ✗ | items.spr(i)->y = guys.spr(guycarryingitem)->y+guys.spr(guycarryingitem)->hyofs+(guys.spr(guycarryingitem)->hysz/2)-10; | |
| 24029 | ✗ | } | |
| 24030 | else | ||
| 24031 | { | ||
| 24032 | ✗ | if(guys.spr(guycarryingitem)->extend >= 3) | |
| 24033 | { | ||
| 24034 | ✗ | items.spr(i)->x = guys.spr(guycarryingitem)->x+(guys.spr(guycarryingitem)->txsz-1)*8; | |
| 24035 | ✗ | items.spr(i)->y = guys.spr(guycarryingitem)->y-2+(guys.spr(guycarryingitem)->tysz-1)*8; | |
| 24036 | ✗ | } | |
| 24037 | else | ||
| 24038 | { | ||
| 24039 | ✗ | items.spr(i)->x = guys.spr(guycarryingitem)->x; | |
| 24040 | ✗ | items.spr(i)->y = guys.spr(guycarryingitem)->y - 2; | |
| 24041 | } | ||
| 24042 | } | ||
| 24043 | ✗ | items.spr(i)->z = guys.spr(guycarryingitem)->z; | |
| 24044 | ✗ | items.spr(i)->fakez = guys.spr(guycarryingitem)->fakez; | |
| 24045 | ✗ | } | |
| 24046 | else | ||
| 24047 | { | ||
| 24048 | 4808 | items.spr(i)->x = guys.spr(guycarryingitem)->x; | |
| 24049 | 4808 | items.spr(i)->y = guys.spr(guycarryingitem)->y - 2; | |
| 24050 | 4808 | items.spr(i)->fakez = guys.spr(guycarryingitem)->fakez; | |
| 24051 | } | ||
| 24052 | 4808 | } | |
| 24053 | 12029 | } | |
| 24054 | 12784 | } | |
| 24055 | 6417004 | } | |
| 24056 | |||
| 24057 | ✗ | bool enemy::IsBigAnim() | |
| 24058 | { | ||
| 24059 | ✗ | return (anim == a2FRMB || anim == a4FRM8EYEB || anim == a4FRM4EYEB | |
| 24060 | ✗ | || anim == a4FRM8DIRFB || anim == a4FRM4DIRB || anim == a4FRM4DIRFB | |
| 24061 | ✗ | || anim == a4FRM8DIRB); | |
| 24062 | } | ||
| 24063 | |||
| 24064 | const char *old_guy_string[OLDMAXGUYS] = | ||
| 24065 | { | ||
| 24066 | "(None)","Abei","Ama","Merchant","Moblin","Fire","Fairy","Goriya","Zelda","Abei 2","Empty","","","","","","","","","", | ||
| 24067 | // 020 | ||
| 24068 | "Octorok (L1, Slow)","Octorok (L2, Slow)","Octorok (L1, Fast)","Octorok (L2, Fast)","Tektite (L1)", | ||
| 24069 | // 025 | ||
| 24070 | "Tektite (L2)","Leever (L1)","Leever (L2)","Moblin (L1)","Moblin (L2)", | ||
| 24071 | // 030 | ||
| 24072 | "Lynel (L1)","Lynel (L2)","Peahat (L1)","Zora","Rock", | ||
| 24073 | // 035 | ||
| 24074 | "Ghini (L1, Normal)","Ghini (L1, Phantom)","Armos","Keese (CSet 7)","Keese (CSet 8)", | ||
| 24075 | // 040 | ||
| 24076 | "Keese (CSet 9)","Stalfos (L1)","Gel (L1, Normal)","Zol (L1, Normal)","Rope (L1)", | ||
| 24077 | // 045 | ||
| 24078 | "Goriya (L1)","Goriya (L2)","Trap (4-Way)","Wall Master","Darknut (L1)", | ||
| 24079 | // 050 | ||
| 24080 | "Darknut (L2)","Bubble (Sword, Temporary Disabling)","Vire (Normal)","Like Like","Gibdo", | ||
| 24081 | // 055 | ||
| 24082 | "Pols Voice (Arrow)","Wizzrobe (Teleporting)","Wizzrobe (Floating)","Aquamentus (Facing Left)","Moldorm", | ||
| 24083 | // 060 | ||
| 24084 | "Dodongo","Manhandla (L1)","Gleeok (1 Head)","Gleeok (2 Heads)","Gleeok (3 Heads)", | ||
| 24085 | // 065 | ||
| 24086 | "Gleeok (4 Heads)","Digdogger (1 Kid)","Digdogger (3 Kids)","Digdogger Kid (1)","Digdogger Kid (2)", | ||
| 24087 | // 070 | ||
| 24088 | "Digdogger Kid (3)","Digdogger Kid (4)","Gohma (L1)","Gohma (L2)","Lanmola (L1)", | ||
| 24089 | // 075 | ||
| 24090 | "Lanmola (L2)","Patra (L1, Big Circle)","Patra (L1, Oval)","Ganon","Stalfos (L2)", | ||
| 24091 | // 080 | ||
| 24092 | "Rope (L2)","Bubble (Sword, Permanent Disabling)","Bubble (Sword, Re-enabling)","Shooter (Fireball)","Item Fairy ", | ||
| 24093 | // 085 | ||
| 24094 | "Fire","Octorok (Magic)", "Darknut (Death Knight)", "Gel (L1, Tribble)", "Zol (L1, Tribble)", | ||
| 24095 | // 090 | ||
| 24096 | "Keese (Tribble)", "Vire (Tribble)", "Darknut (Splitting)", "Aquamentus (Facing Right)", "Manhandla (L2)", | ||
| 24097 | // 095 | ||
| 24098 | "Trap (Horizontal, Line of Sight)", "Trap (Vertical, Line of Sight)", "Trap (Horizontal, Constant)", "Trap (Vertical, Constant)", "Wizzrobe (Fire)", | ||
| 24099 | // 100 | ||
| 24100 | "Wizzrobe (Wind)", "Ceiling Master ", "Floor Master ", "Patra (BS Zelda)", "Patra (L2)", | ||
| 24101 | // 105 | ||
| 24102 | "Patra (L3)", "Bat", "Wizzrobe (Bat)", "Wizzrobe (Bat 2) ", "Gleeok (Fire, 1 Head)", | ||
| 24103 | // 110 | ||
| 24104 | "Gleeok (Fire, 2 Heads)", "Gleeok (Fire, 3 Heads)","Gleeok (Fire, 4 Heads)", "Wizzrobe (Mirror)", "Dodongo (BS Zelda)", | ||
| 24105 | // 115 | ||
| 24106 | "Dodongo (Fire) ","Trigger", "Bubble (Item, Temporary Disabling)", "Bubble (Item, Permanent Disabling)", "Bubble (Item, Re-enabling)", | ||
| 24107 | // 120 | ||
| 24108 | "Stalfos (L3)", "Gohma (L3)", "Gohma (L4)", "NPC 1 (Standing) ", "NPC 2 (Standing) ", | ||
| 24109 | // 125 | ||
| 24110 | "NPC 3 (Standing) ", "NPC 4 (Standing) ", "NPC 5 (Standing) ", "NPC 6 (Standing) ", "NPC 1 (Walking) ", | ||
| 24111 | // 130 | ||
| 24112 | "NPC 2 (Walking) ", "NPC 3 (Walking) ", "NPC 4 (Walking) ", "NPC 5 (Walking) ", "NPC 6 (Walking) ", | ||
| 24113 | // 135 | ||
| 24114 | "Boulder", "Goriya (L3)", "Leever (L3)", "Octorok (L3, Slow)", "Octorok (L3, Fast)", | ||
| 24115 | // 140 | ||
| 24116 | "Octorok (L4, Slow)", "Octorok (L4, Fast)", "Trap (8-Way) ", "Trap (Diagonal) ", "Trap (/, Constant) ", | ||
| 24117 | // 145 | ||
| 24118 | "Trap (/, Line of Sight) ", "Trap (\\, Constant) ", "Trap (\\, Line of Sight) ", "Trap (CW, Constant) ", "Trap (CW, Line of Sight) ", | ||
| 24119 | // 150 | ||
| 24120 | "Trap (CCW, Constant) ", "Trap (CCW, Line of Sight) ", "Wizzrobe (Summoner)", "Wizzrobe (Ice) ", "Shooter (Magic)", | ||
| 24121 | // 155 | ||
| 24122 | "Shooter (Rock)", "Shooter (Spear)", "Shooter (Sword)", "Shooter (Fire)", "Shooter (Fire 2)", | ||
| 24123 | // 160 | ||
| 24124 | "Bombchu", "Gel (L2, Normal)", "Zol (L2, Normal)", "Gel (L2, Tribble)", "Zol (L2, Tribble)", | ||
| 24125 | // 165 | ||
| 24126 | "Tektite (L3) ", "Spinning Tile (Combo)", "Spinning Tile (Enemy Sprite)", "Lynel (L3) ", "Peahat (L2) ", | ||
| 24127 | // 170 | ||
| 24128 | "Pols Voice (Magic) ", "Pols Voice (Whistle) ", "Darknut (Mirror) ", "Ghini (L2, Fire) ", "Ghini (L2, Magic) ", | ||
| 24129 | // 175 | ||
| 24130 | "Grappler Bug (HP) ", "Grappler Bug (MP) " | ||
| 24131 | }; | ||
| 24132 | |||
| 24133 | /*** end of guys.cc ***/ | ||
| 24134 | |||
| 24135 |